wp_robots
Filters the directives to be included in the 'robots' meta tag.
The meta tag will only be included as necessary.
Usage
add_filter( 'wp_robots', 'wp_kama_robots_filter' ); /** * Function for `wp_robots` filter-hook. * * @param array $robots 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 `true` if it is a boolean directive, i.e. without a value. * * @return array */ function wp_kama_robots_filter( $robots ){ // filter... return $robots; }
- $robots(array)
- 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 true if it is a boolean directive, i.e. without a value.
Changelog
Since 5.7.0 | Introduced. |
Where the hook is called
wp_robots
wp-includes/robots-template.php 32
$robots = apply_filters( 'wp_robots', array() );
Where the hook is used in WordPress
wp-activate.php 119
add_filter( 'wp_robots', 'wp_robots_sensitive_page' );
wp-includes/class-wp-customize-manager.php 1921
add_filter( 'wp_robots', 'wp_robots_no_robots' );
wp-includes/default-filters.php 267
add_filter( 'wp_robots', 'wp_robots_noindex' );
wp-includes/default-filters.php 268
add_filter( 'wp_robots', 'wp_robots_noindex_embeds' );
wp-includes/default-filters.php 269
add_filter( 'wp_robots', 'wp_robots_noindex_search' );
wp-includes/default-filters.php 270
add_filter( 'wp_robots', 'wp_robots_max_image_preview_large' );
wp-includes/default-filters.php 366
add_filter( 'wp_robots', 'wp_robots_no_robots' );
wp-includes/functions.php 3864
add_filter( 'wp_robots', 'wp_robots_no_robots' );
wp-includes/functions.php 3866
remove_filter( 'wp_robots', 'wp_robots_noindex_embeds' );
wp-includes/functions.php 3867
remove_filter( 'wp_robots', 'wp_robots_noindex_search' );
wp-login.php 49
add_filter( 'wp_robots', 'wp_robots_sensitive_page' );
wp-signup.php 6
add_filter( 'wp_robots', 'wp_robots_no_robots' );