Skip to content

Commit

Permalink
Disable crawling for VIP convenience domains (#5129)
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccahum committed Feb 1, 2024
1 parent f75ee88 commit 8fd5854
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions 001-core/privacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,3 +457,22 @@ function delete_old_export_files() {
}
}
}

/**
* Disable crawling for go-vip.co and go-vip.net domains.
*
* @param string $output The robots.txt content.
* @return string The modified robots.txt content.
*/
function vip_convenience_domain_robots_txt( $output ) {
$host = strtolower( $_SERVER['HTTP_HOST'] ?? '' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
if ( false !== strpos( $host, '.go-vip.co' ) || false !== strpos( $host, '.go-vip.net' ) ) {
$output = "# Crawling is blocked for go-vip.co and go-vip.net domains\n";
$output .= "User-agent: *\n";
$output .= "Disallow: /\n";
}

return $output;
}
// phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.robots_txt
add_filter( 'robots_txt', __NAMESPACE__ . '\vip_convenience_domain_robots_txt' );

0 comments on commit 8fd5854

Please sign in to comment.