How to activate WordPress maintenance mode

Even though you have a live website which is getting new visitors all the time, that doesn’t mean your work is done. Every now and then, you will have to change elements on your website, integrate new functions or completely redesign your website. And when the time comes, you don’t want your site to be accessible to everyone while you’re working on it.

That’s where a maintenance mode can come in handy. Instead of letting people browse through your site and see it breaking apart because you have changed something, you should consider activating maintenance mode. This way, you can deny access to your website to everyone but yourself (admin) and allow yourself a safe and calm working environment.

There are different ways of activating the maintenance mode. Unfortunately, there is no option which you can easily activate from WordPress settings, but you can make yourself a simple maintenance page which will tell a visitor that you’re busy rebuilding the site.

In this article, we’re about to show you how to activate maintenance mode and display a simple message to your visitors.

  1. Open functions.php file
  2. Copy and paste the following snippet:
  3. function maintenace_mode() {
    if ( !current_user_can( 'administrator' ) ) {
    wp_die('Maintenance. Please visit us later.');
    }
    }
    add_action('get_header', 'maintenace_mode');
  4. Save changes

After you copy and paste the code, you can test the site. Everyone but administrators will get the message which you can edit on the third line of the code, while administrators will be able to use the site as nothing happened.

Once you are ready to activate your site again, you can easily comment out the entire function (simply put “//” before the functions) or you can delete it completely from your functions.php file. After you do that, the site will be working just like before and your maintenance mode will be over.

If this is too simple for you and you want to create a much more detailed maintenance pages, you should use a plugin for the job. We suggest using a free Under Construction Page plugin which can be installed from WordPress plugins repository and set up in just a few seconds.

Under Construction Page

PRICE: Free

Under Construction Page

The plugin allows you to choose a theme (background image), it lets you edit a title, add custom text, images, and videos to your under construction page. You can also add your social media accounts and let people connect with you while you’re working on your site. Under Construction Page also lets you whitelist specific user roles which won’t be affected by the plugin – instead of showing the under construction page to everyone, you can specify users roles who will still see the original site. Check out the Under Construction Page review.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

One thought on “How to activate WordPress maintenance mode

  1. […] you’re still in the process of launching your site or just looking to put your site in maintenance mode for some time, it’ll help you do that without discouraging your visitors and losing social […]

Leave a Reply

Your email address will not be published. Required fields are marked *