WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 23 | * |
| 24 | * The meta tag will only be included as necessary. |
| 25 | * |
| 26 | * @since 5.7.0 |
| 27 | * |
| 28 | * @param array $robots Associative array of directives. Every key must be the name of the directive, and the |
| 29 | * corresponding value must either be a string to provide as value for the directive or a |
| 30 | * boolean `true` if it is a boolean directive, i.e. without a value. |
| 31 | */ |
| 32 | $robots = apply_filters( 'wp_robots', array() ); |
| 33 | |
| 34 | $robots_strings = array(); |
| 35 | foreach ( $robots as $directive => $value ) { |
| 36 | if ( is_string( $value ) ) { |
| 37 | // If a string value, include it as value for the directive. |
| 38 | $robots_strings[] = "{$directive}:{$value}"; |
| 39 | } elseif ( $value ) { |
| 40 | // Otherwise, include the directive if it is truthy. |
| 41 | $robots_strings[] = $directive; |