Last active
January 11, 2025 02:56
-
-
Save Nerd-Rush/cdb8e611478d9b554afc845fe23784af to your computer and use it in GitHub Desktop.
Discourage Search Engine Alert - WordPress
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
add_action('admin_head', 'custom_admin_bar_color'); | |
add_action('wp_head', 'custom_admin_bar_color'); | |
function custom_admin_bar_color() { | |
// Check if the "Discourage search engines from indexing this site" setting is enabled | |
if (get_option('blog_public') == '0') { | |
// Output CSS to change the admin bar color | |
echo '<style> | |
#wpadminbar { | |
border-top: 5px solid #cf0000 !important; | |
background: #650000 !important; | |
} | |
</style>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment