Robots: Rename wp_embed_no_robots to wp_robots_noindex_embeds().

This brings the naming in line with `wp_robots_noindex_search()`.

Follow-up to [49992], [50370].

See #51511, #52457.

git-svn-id: https://develop.svn.wordpress.org/trunk@50371 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-02-17 10:49:13 +00:00
parent f400eb5ab9
commit 135d567399
3 changed files with 25 additions and 21 deletions
+24
View File
@@ -74,6 +74,7 @@ function wp_robots() {
* add_filter( 'wp_robots', 'wp_robots_noindex' );
*
* @since 5.7.0
*
* @see wp_robots_no_robots()
*
* @param array $robots Associative array of robots directives.
@@ -87,6 +88,28 @@ function wp_robots_noindex( array $robots ) {
return $robots;
}
/**
* Adds noindex to the robots meta tag for embeds.
*
* Typical usage is as a {@see 'wp_robots'} callback:
*
* add_filter( 'wp_robots', 'wp_robots_noindex_embeds' );
*
* @since 5.7.0
*
* @see wp_robots_no_robots()
*
* @param array $robots Associative array of robots directives.
* @return array Filtered robots directives.
*/
function wp_robots_noindex_embeds( array $robots ) {
if ( is_embed() ) {
return wp_robots_no_robots( $robots );
}
return $robots;
}
/**
* Adds noindex to the robots meta tag if a search is being performed.
*
@@ -99,6 +122,7 @@ function wp_robots_noindex( array $robots ) {
* add_filter( 'wp_robots', 'wp_robots_noindex_search' );
*
* @since 5.7.0
*
* @see wp_robots_no_robots()
*
* @param array $robots Associative array of robots directives.