• Resolved Gio

    (@giothelawa)


    Hi Sybre,

    What’s the parameter of search url? to the callback function to change it?

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    I think you’re looking for filter the_seo_framework_ld_json_search_url.

    If that doesn’t give enough control, try using the_seo_framework_receive_json_data that allows you to overwrite it completely.

    Thread Starter Gio

    (@giothelawa)

    Sybre, I tried this

    add_filter( 'the_seo_framework_ld_json_search_url',  function( $url ) {
        return home_url( '/?????????-??????????/?search_keywords={search_term_string}&sort=latest' );
    });

    But SST is still added at the end, as shown on the screen https://imgur.com/i2I1nF5. Unfortunately, nothing is searched on how to use the_seo_framework_receive_json_data, please give me a hint…

    • This reply was modified 4 years, 3 months ago by Gio.
    Thread Starter Gio

    (@giothelawa)

    STS, sorry.

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi Gio!

    It should look a bit like this:

    add_filter( 'the_seo_framework_receive_json_data', function( $data, $key ) {
    
    	if ( 'website' === $key ) {
    		if ( isset( $data['potentialAction']['@type'] ) && 'SearchAction' === $data['potentialAction']['@type'] ) {
    			$data['potentialAction']['target']      = home_url( rawurlencode( '?????????-??????????' ) . '/?search_keywords={search_term_string}&sort=latest' );
    			$data['potentialAction']['query-input'] = 'required name=search_term_string';
    		}
    	}
    
    	return $data;
    }, 10, 2 );
    Thread Starter Gio

    (@giothelawa)

    Hi,

    You made my day. Thanks a lot, Sybre.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Search url parameter’ is closed to new replies.