array $robots )
Filters the directives to be included in the ‘robots’ meta tag.
The meta tag will only be included as necessary.
Associative array of directives. Every key must be the name of the directive, and the corresponding value must either be a string to provide as value for the directive or a boolean
trueif it is a boolean directive, i.e. without a value.
View all references
$robots = apply_filters( 'wp_robots', array() );
Example of adding a noindex robots tag.
To affect pages with a certain page template, you can add this directly to the template, as long as it’s above the call to
To have more granular control over what pages are affected, you can add the snippet to your functions.php file and work with the current page inside the function: