Skip to content

Instantly share code, notes, and snippets.

@thetwopct
Created December 22, 2018 05:51
Show Gist options
  • Save thetwopct/6285a317ef29477872c75b404ab41aee to your computer and use it in GitHub Desktop.
Save thetwopct/6285a317ef29477872c75b404ab41aee to your computer and use it in GitHub Desktop.
WordPress Maintenance Mode in Functions.php only
// MAINTENANCE MODE
function wp_maintenance_mode(){
if(!current_user_can('edit_themes') || !is_user_logged_in()){
wp_die('<h1 style="color:black">Site Name - We\'ll be back soon</h1><br />We are performing scheduled maintenance. Our website will be back shortly.', 'Title (Maintenance Mode)');
}
}
add_action('get_header', 'wp_maintenance_mode');
// Comment the last line to start/stop maintenance mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment