Skip to content

Instantly share code, notes, and snippets.

@nfreader
Created January 9, 2014 16:02
Show Gist options
  • Save nfreader/8336581 to your computer and use it in GitHub Desktop.
Save nfreader/8336581 to your computer and use it in GitHub Desktop.
<?php
//Shows a big red banner to administrative users if search engines are blocked on a Wordpress site
function enginesBlocked() {
global $wpdb;
if (current_user_can('manage_options')) {
$table = $wpdb->prefix . "options";
if ($wpdb->get_var("SELECT option_value FROM $table WHERE option_name = 'blog_public'") == 0) {
echo '<div style="background:#C0392B; color: white; padding: 5px; border; 2px solid #E74C3C; width: 100%; box-sizing: border-box; -moz-box-sizing: border-box; font-size: 32px; text-align: center;">Search Engines Blocked!</div>';
}
}
}
add_action('wp_head', 'enginesBlocked');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment