Any idea how to check if the website is hidden from search engines? The reason is I want to show a big red banner at the top of the homepage when this option is checked because I always forget that this option is checked.

4 Answers 4


The setting is stored in the option blog_public.

if( 0 == get_option( 'blog_public' ) ){
    echo 'search engines discouraged';

Pretty sure I stole borrowed the following piece of code from the very handy and useful Yoast Plugin:

 * Check if Website is visible to Search Engines
function wpse_check_visibility() {
    if ( ! class_exists( 'WPSEO_Admin' ) ) {
        if ( '0' == get_option( 'blog_public' ) ) {
            add_action( 'admin_footer', 'wpse_private_wp_warning' );
add_action( 'admin_init', 'wpse_check_visibility' );

 * If website is Private, show alert
function wpse_private_wp_warning() {
    if ( ( function_exists( 'is_network_admin' ) && is_network_admin() ) ) {

    echo '<div id="robotsmessage" class="error">';
    echo '<p><strong>' . __( 'Huge SEO Issue: You\'re blocking access to robots.', 'wpse-seo' ) . '</strong> ' . sprintf( __( 'You must %sgo to your Reading Settings%s and uncheck the box for Search Engine Visibility.', 'wordpress-seo' ), '<a href="' . esc_url( admin_url( 'options-reading.php' ) ) . '">', '</a>' ) . '</p></div>';

Pretty much on admin_init we check if our site is private. If it is we're going to use the footer and WordPress alert styles to tell us that the site is private. The WPSEO_Admin is Yoast as I believe they will also tell you the site is private if it's installed so we don't want to step on their toes.

  • Maybe an alternative would be to display the warning in the admin bar, both on frontend and backend? I'm sure we could find a suitable dashicon with it ;-)
    – birgire
    Mar 30, 2016 at 17:18

Another way to see if your Website is hidden from Search Engines is going to Settings » Privacy Settings

The Site Privacy setting controls who can view your site, allowing you to make the site private or public. To access this setting, go to My Site → Settings and look for Privacy.

enter image description here

Privacy Options

  1. Public: This is the setting used by most sites. It allows everyone to read your site and enables your site to be included in search engine results and other content sites.

  2. Hidden: If you want all human visitors to be able to read your blog, but want to block web crawlers for search engines, this is the setting for you. (Please note, however, that not all search engines respect this setting.)

  3. Private: Select this option to make your site private. If you want specific people to be able to view it (and add comments, if you’ve enabled them), you’ll need to invite them to be a viewer.

  • You misunderstood the Question. It's about seeing it in the Frontend (so the customer can see it without checking the backend). More like an "alert", you know ... . Aug 29, 2018 at 8:03
  • Ahh Ok, ok I totally understood something else. Thanks for explaining @henning-fischer Aug 29, 2018 at 14:37

Using this since Milos answer on every WordPress project as a handy snippet (put it right after the opening body tag):

<?php if ( is_user_logged_in() ) { ?>
        a.searchengines_blocked {
            position: fixed;
            bottom: 0;
            left: 0;
            z-index: 99999;
            color: black !important;
            background-color: #ffcd1b !important;
            font-weight: normal;
            font-size: 1.8rem;
            padding: 6px 15px;
            text-align: center;
            vertical-align: middle;
            border-top-right-radius: 10px;
        if( 0 == get_option( 'blog_public' ) ){
            echo '<a href="./wp-admin/options-reading.php" class="searchengines_blocked">!G</a>';
<?php } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.