Skip to content

Instantly share code, notes, and snippets.

@rinatkhaziev
Forked from mjangda/s-maintenance-mode.php
Created August 18, 2012 01:36
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 rinatkhaziev/3383850 to your computer and use it in GitHub Desktop.
Save rinatkhaziev/3383850 to your computer and use it in GitHub Desktop.
Custom WordPress maintenance mode that allows super admins access to the Dashboard
<?php
add_action( 'init', 'x_maintenance_mode' );
function x_maintenance_mode() {
if ( defined( 'X_MAINTENANCE_MODE' ) && true === X_MAINTENANCE_MODE ) {
if ( is_super_admin() && is_admin() )
return;
die( 'Site is currently under maintenance' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment