Skip to content

Instantly share code, notes, and snippets.

@wormeyman
Last active February 16, 2018 21:50
Embed
What would you like to do?
// Alert on Staging Site
// http://stackoverflow.com/questions/6522023/php-if-domain
$host = $_SERVER['HTTP_HOST'];
if ($host != 'XXXXXXXXXX.com') {
function staging_admin_error_notice()
{
$class = "error";
$message = "You are on the staging site.";
echo"<div class=\"$class\"> <h1>$message</h1></div>";
}
add_action('admin_notices', 'staging_admin_error_notice');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment