Filter hook 'wp_robots'

in WP Core File wp-includes/robots-template.php at line 32

Description

Filters the directives to be included in the 'robots' meta tag. The meta tag will only be included as necessary.

Occurrences

Filename Line Number
wp-includes/robots-template.php 32

Parameters

Type Name Description
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.

Usage Examples

Example 1

add_filter( 'wp_robots', 'wp_robots_noindex'

Example 2

add_filter( 'wp_robots', 'wp_robots_noindex_embeds'

Example 3

add_filter( 'wp_robots', 'wp_robots_noindex_search'

Example 4

add_filter( 'wp_robots', 'wp_robots_no_robots'

Example 5

add_filter( 'wp_robots', 'wp_robots_sensitive_page'

Example 6

add_filter( 'wp_robots', 'wp_robots_max_image_preview_large'

PHP Doc

/**
	 * Filters the directives to be included in the 'robots' meta tag.
	 *
	 * The meta tag will only be included as necessary.
	 *
	 * @since 5.7.0
	 *
	 * @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.
	 */