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 https://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!
Leave a Reply