Created
January 9, 2014 16:02
-
-
Save nfreader/8336581 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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