Skip to content

Commit

Permalink
Noindex unapproved comment previews.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwilsoncc committed Jan 1, 2025
1 parent de14028 commit 6bc8b21
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,13 @@
add_action( 'wp_enqueue_scripts', 'wp_enqueue_emoji_styles' );
add_action( 'wp_print_styles', 'print_emoji_styles' ); // Retained for backwards-compatibility. Unhooked by wp_enqueue_emoji_styles().

if ( isset( $_GET['replytocom'] ) ) {
if (
// Comment reply link.
isset( $_GET['replytocom'] )
||
// Unapproved comment preview.
( isset( $_GET['unapproved'] ) && isset( $_GET['moderation-hash'] ) )
) {
add_filter( 'wp_robots', 'wp_robots_no_robots' );
}

Expand Down

0 comments on commit 6bc8b21

Please sign in to comment.