diff --git a/web/app/mu-plugins/disallow-indexing.php b/web/app/mu-plugins/disallow-indexing.php index dcfe319ca9..b134edea2e 100644 --- a/web/app/mu-plugins/disallow-indexing.php +++ b/web/app/mu-plugins/disallow-indexing.php @@ -3,12 +3,24 @@ Plugin Name: Disallow Indexing Plugin URI: https://roots.io/bedrock/ Description: Disallow indexing of your site on non-production environments. -Version: 1.0.0 +Version: 2.0.0 Author: Roots Author URI: https://roots.io/ +Text Domain: roots License: MIT License */ -if (defined('WP_ENV') && WP_ENV !== 'production' && !is_admin()) { - add_action('pre_option_blog_public', '__return_zero'); +if (!defined('WP_ENV') || WP_ENV === 'production') { + return; } + +add_action('pre_option_blog_public', '__return_zero'); + +add_action('admin_notices', function () { + $message = sprintf( + __('%1$s Search engine indexing has been discouraged because the current environment is %2$s.', 'roots'), + 'Bedrock:', + ''.WP_ENV.'' + ); + echo "

{$message}

"; +});