Created
December 22, 2018 05:51
-
-
Save thetwopct/6285a317ef29477872c75b404ab41aee to your computer and use it in GitHub Desktop.
WordPress Maintenance Mode in Functions.php only
This file contains 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
// 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