From a9d04adf20b69a3c658523cd8ac94e574e5b504e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 17 Feb 2021 10:51:04 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@50371 git-svn-id: http://core.svn.wordpress.org/trunk@49982 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-filters.php | 2 +- wp-includes/embed.php | 20 -------------------- wp-includes/robots-template.php | 24 ++++++++++++++++++++++++ wp-includes/version.php | 2 +- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 783606df4b..7e0ecd64d3 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -238,6 +238,7 @@ add_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); // Robots filters. add_filter( 'wp_robots', 'wp_robots_noindex' ); +add_filter( 'wp_robots', 'wp_robots_noindex_embeds' ); add_filter( 'wp_robots', 'wp_robots_noindex_search' ); add_filter( 'wp_robots', 'wp_robots_max_image_preview_large' ); @@ -611,7 +612,6 @@ add_action( 'embed_footer', 'print_embed_sharing_dialog' ); add_action( 'embed_footer', 'print_embed_scripts' ); add_action( 'embed_footer', 'wp_print_footer_scripts', 20 ); -add_filter( 'wp_robots', 'wp_embed_no_robots' ); add_filter( 'excerpt_more', 'wp_embed_excerpt_more', 20 ); add_filter( 'the_excerpt_embed', 'wptexturize' ); add_filter( 'the_excerpt_embed', 'convert_chars' ); diff --git a/wp-includes/embed.php b/wp-includes/embed.php index 6bcc47baf0..604c76a431 100644 --- a/wp-includes/embed.php +++ b/wp-includes/embed.php @@ -1246,23 +1246,3 @@ function wp_filter_pre_oembed_result( $result, $url, $args ) { return $result; } - -/** - * Adds noindex to the robots meta tag for embeds. - * - * Typical usage is as a {@see 'wp_robots'} callback: - * - * add_filter( 'wp_robots', 'wp_embed_no_robots' ); - * - * @since 5.7.0 - * - * @param array $robots Associative array of robots directives. - * @return array Filtered robots directives. - */ -function wp_embed_no_robots( array $robots ) { - if ( ! is_embed() ) { - return $robots; - } - - return wp_robots_no_robots( $robots ); -} diff --git a/wp-includes/robots-template.php b/wp-includes/robots-template.php index 61931a25e5..19c7699790 100644 --- a/wp-includes/robots-template.php +++ b/wp-includes/robots-template.php @@ -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. diff --git a/wp-includes/version.php b/wp-includes/version.php index ff6bde176b..53260a95b3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-beta3-50370'; +$wp_version = '5.7-beta3-50371'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.