Adds noindex to the robots meta tag if a search is being performed.
Description
If a search is being performed then noindex will be output to tell web robots not to index the page content. Add this to the 'wp_robots' filter. Typical usage is as a 'wp_robots' callback: add_filter( 'wp_robots', 'wp_robots_noindex_search' );
Parameters
$robotsarray
Associative array of robots directives.
Return
array
Filtered robots directives.
Uses · 2
is_search()Determines whether the query is for a search.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/robots-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.