Skip to content

Instantly share code, notes, and snippets.

@wormeyman
Last active February 16, 2018 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wormeyman/1e3ebf702845d5e1d520652734334a23 to your computer and use it in GitHub Desktop.
Save wormeyman/1e3ebf702845d5e1d520652734334a23 to your computer and use it in GitHub Desktop.
// 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