Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Very simple WordPress plugin that warns a user if their blog can not be indexed by search engines.
* Plugin Name: Blog not public admin notice
* Description: Because this checkbox costs real people real money
* Version: 1.0.0
* Author: daggerhart
add_action( 'wp_ajax_dismiss_blog_not_public_notice', function(){
update_option('blog_not_public_notice_dismissed', 1);
if ( !$_GET['is_ajax'] ){
wp_redirect( wp_get_referer() );
add_action( 'admin_notices', function(){
$public = get_option( 'blog_public', 0 );
$notice_dismissed = get_option( 'blog_not_public_notice_dismissed', 0 );
if ( !$public && !$notice_dismissed )
#blog_not_public_notice {
float: right;
margin: 6px;
<script type="text/javascript">
var $btn = $(this);
$.get( $btn.attr('href'), { is_ajax: true }, function(){
} );
<div class="error">
<a id="blog_not_public_notice" href="<?php echo esc_attr( admin_url('admin-ajax.php?action=dismiss_blog_not_public_notice') ) ?>"><?php _e( 'dismiss' ); ?></a>
<strong><?php _e('Site hidden from search engines') ?></strong>
<?php _e('This website is not able to be indexed by Google or other search engines. To fix this problem click on the following link and un-check the "Search Engine Visibility" checkbox.') ?>
<a class="button" href="<?php esc_attr( admin_url('options-reading.php') ) ?>"><?php _e('Click here to fix') ?></a>
} );

This comment has been minimized.

Copy link
Owner Author

@daggerhart daggerhart commented Apr 12, 2017



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment