Skip to content

Commit

Permalink
Blog Privacy: Don't add custom rules to wpcom robots.txt if blog_publ…
Browse files Browse the repository at this point in the history
…ic=0 (#39468)

* Don't clutter wpcom's robots.txt if blog_public=0.

* changelog
  • Loading branch information
dereksmart authored and gogdzl committed Oct 25, 2024
1 parent 66304b3 commit afaff2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Blog Privacy: Do not add custom rules to wpcom's robots.txt if blog_public=0
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ function robots_txt( string $output, $public ): string {
$public = (int) $public;

// If the site is completely private, don't bother with the additional restrictions.
if ( -1 === $public ) {
// For blog_public=0, WP.com Disallows all user agents and Core does not (relying on <meta name="robots">).
// Let wpcom do it's thing to not clutter the robots.txt file.
if ( -1 === $public || ( 0 === $public && defined( 'IS_WPCOM' ) && IS_WPCOM ) ) {
return $output;
}

// For blog_public=0, WP.com Disallows all user agents and Core does not (relying on <meta name="robots">).
// Always add Disallow blocks for blog_public=0 even on WP.com where it may be redundant.
// An option oddly named because of history.
if ( 0 === $public || get_option( 'wpcom_data_sharing_opt_out' ) ) {
$ai_bots = array(
Expand Down

0 comments on commit afaff2a

Please sign in to comment.