If you use WordPress as a publishing tool and platform, I am sure you know that you occasionally can or need to put your WordPress site into maintenance mode. Perhaps you are re-building your website, changing the theme, or test new functionalities or other maintenance of your website. Then it’s great to be able to quickly put your website into maintenance mode and let your visitors and readers know what is going on on your website. There are different ways to use the Maintenance Mode. There are a lot of plugins, both free and premium which includes features that can help you create a simple or more advanced maintenance mode page. Or you can choose a method without plugins. Choose the option you feel comfortable with.
// Activate WordPress Maintenance Mode function wp_maintenance_mode(){ if(!current_user_can('edit_themes') || !is_user_logged_in()){ wp_die('<h1 style="color:red">Website under Maintenance</h1><br />We are performing scheduled maintenance. We will be back on-line shortly!'); } } add_action('get_header', 'wp_maintenance_mode');