Viewing 3 replies - 1 through 3 (of 3 total)
  • i am trying to add this into my functions.php but it keeps throwing an error.

    // add_filter(‘wpseo_json_ld_search_url’, ‘(URL HERE)?search={search_term}&post_type=product’);

    : call_user_func_array() expects parameter 1 to be a valid callback, function ‘URL/?search={search_term}&post_type=product’ not found or invalid function name in

    Use this code

    function change_json_ld_search_url( $str ) {
    $home_url = trailingslashit( home_url() );
    $str = $home_url . ‘?s={search_term}&post_type=product’;
    return $str;
    }
    add_filter( ‘wpseo_json_ld_search_url’, ‘change_json_ld_search_url’, 10, 1 );

    Thread Starter baddjuju

    (@baddjuju)

    Thank you samueljeden. This worked perfectly in changing the search query URL.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to remove site search box json code from HEAD in newest version of Yoast?’ is closed to new replies.