Last active
February 11, 2021 08:50
-
-
Save roscabgdn/97bcfb764af4b35420f268a56fc2fc98 to your computer and use it in GitHub Desktop.
If you need to go into temporary maintenance mode and close the site to visitors in the meantime, you can enter the below code:
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
/* | |
* http://blog.templatetoaster.com/15-useful-code-snippets-for-your-wordpress-site/ | |
*/ | |
function wp_maintenance_mode(){ | |
if(!current_user_can('edit_themes') || !is_user_logged_in()){ | |
wp_die('Maintenance, please come back soon.', 'Maintenance – please come back soon.', array('response' => '503')); | |
} | |
} | |
add_action('get_header', 'wp_maintenance_mode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment