wpseo_json_ld_search_url – filter for Yoast SEO

wpseo_json_ld_search_url is a filter for the most popular WordPress SEO plugin. As you know, the most popular and helpful SEO plugin for WordPress is Yoast. In this quick tutorial, we’ll take a closer look at this filter and talk a bit about the alternative filter.

wpseo_json_ld_search_url

The main role of the filter wpseo_json_ld_search_url is to allow filtering of the search URL for the Yoast SEO plugin.

You can see an example of using this filter in the image below.

wpseo_json_ld_search_url - filter for Yoast SEO

$search_url is a string variable.

This filter can be used for various purposes. For more information about this filter, you can check the Yoast Schema – API documentation and learn more.

In the Yoast plugin, this filter is used once. The file location of this filter is wordpress-seo\src\generators\schema\website.php

It is located on line 85 and looks like this:

$search_url = \apply_filters( 'wpseo_json_ld_search_url', $this->context->site_url . '?s={search_term_string}' );

This is all information about this filter. If you have other questions about this filter, you can contact the Yoast SEO team or ask your question by creating a new forum thread on WordPress.org.

An alternative is disable_wpseo_json_ld_search

The disable_wpseo_json_ld_search is an alternative to wpseo_json_ld_search_url. If you don’t need part of the schema, you can easily disable it using the alternative filter. By the way, you can disable all Yoast SEO’s schema output entirely if you return “false”. Below you can see the code

add_filter( 'wpseo_json_ld_output', '__return_false' );