How to change SearchAction Query? Sitelinks Search box

#111856
Viewing 7 replies - 1 through 7 (of 7 total)
  • Same problem here! I asked the same question, to which Rank Math hasn’t responded yet.

    Hello,

    Sorry for the delay. We seem to have missed this ticket.

    You can definitely do that using this filter in your theme’s functions.php file:
    https://rankmath.com/kb/filters-hooks-api-developer/#sitelinks-searchbox

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Thanks for your response. It, unfortunately, doesn’t work for me.
    I have the search URL like this: domain.com/?s=some+keyword&post_type=product
    And another one project, the URLs seems like this: domain.com/page-url/?search_keywords=here%20isakeywords&sort=latest

    I think we should be able to change the prefix and suffix of the search term. As well as, among keywords (Consider the second example(%20)).

    Perhaps I should also add the fact that all this is reflected in the schema markup.

    Hello,

    Yes, that is what the filter is for – the JSON Schema.

    Please try this:

    /**
     * Allows filtering of the search URL.
     *
     * @param string $search_url The search URL for this site with a <code>{search_term_string}</code> variable.
     */
    add_filter( 'rank_math/json_ld/search_url',  function( $url ) {
        return home_url( '/page-url/?search_keywords={search_term_string}&sort=latest' );
    });

    Glad to hear from you. I am very grateful. Thanks, guys.

    Hello,

    We are so glad to be of help. We are always here if you need us in the future.

    Hey, if it isn’t too much to ask for – would you mind leaving us a review here?

    https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post

    It only takes a couple of minutes but helps us tremendously.

    It would mean so much to us.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

The ticket ‘How to change SearchAction Query? Sitelinks Search box’ is closed to new replies.