How to enter WordPress Maintenance Mode

Your site may need maintenance from time to time to keep it running smoothly. It is a good idea to keep your site unavailable to visitors while you are doing this maintenance. Just add this WordPress Code Snippet to the functions.php file in your current WordPress theme in order to easily enter WordPress Maintenance Mode.

/**
 * Enter Maintenance Mode
 *
 * @author WPSnacks.com
 * @link http://www.wpsnacks.com
 */
function go_maintenance_mode() {
    if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
        wp_die('Sorry, but we are doing Maintenance on the site, please check back soon.');
    }
}
add_action('get_header', 'go_maintenance_mode');

You can of course change the message above to whatever you would like your visitors to see while you are in Maintenance Mode. Just be sure you remember to either remove this code from your functions.php file or comment it out when you are done working on the site. Hope this helps, enjoy!

   Related Sponsored Links

Disclaimer: The information contained in this website is for general information purposes only and in no event will this site or its owners be liable for any losses or damages associated with your use of our site or content. Click here to see our full Disclaimer.

Leave a Comment

*