Monday, 31 October 2011

How to keep a wordpress site in Quick maintenance mode?

When we are doing some maintenance to our blog at that time we should keep the users not to visit our site. To achieve this we have to keep the blog in maintenance mode.

Some cms (content management systems) will have an inbuilt option at admin panel to keep the website(blog) in maintenance mode or offline mode. In wordpress we don’t have the inbuilt option at admin panel to keep the blog in maintenance mode.

We can achieve this by adding a plugin or by adding the hook to your theme functions.php.

If you want to add the hook copy & paste the following code to your theme functions.php file.

function wpr_maintenance_mode() {  
    if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
        wp_die('We are into Maintenance, please come back soon.');
add_action('get_header', 'wpr_maintenance_mode');

The above code will not allow any user(except admin) to visit the site .

When you are done with the maintenance remove the code from the functions.php .otherwise the users will not able to enter into the site.

Enjoy the maintenance.


  1. lets know about bet gallery plugin for wordpress and its configuration, management stuff..

  2. NextGEN gallery is the Best WordPress gallery plugin

  3. Hi aswani, I will post the configuration and management stuff.