# Warn When Search Engines Are Blocked

> Shows a red notice on every admin screen while "Discourage search engines" is ticked, so a launched site is not left hidden by mistake.

- Type: PHP
- Runs: Admin only
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: admin, seo, notices
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/warn-search-engines-blocked/

## Code

```php
add_action( 'admin_notices', function () {
    if ( '0' !== (string) get_option( 'blog_public' ) || ! current_user_can( 'manage_options' ) ) {
        return;
    }

    printf(
        '<div class="notice notice-error"><p><strong>Search engines are blocked.</strong> This site asks search engines not to index it. <a href="%s">Change this in Reading settings</a>.</p></div>',
        esc_url( admin_url( 'options-reading.php' ) )
    );
} );
```

## Notes

Leave it off on staging sites, where blocking search engines is intended.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Warn When Search Engines Are Blocked" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
