How to Set Up Maintenance Mode on WordPress

There are many times when you are making critical updates to your WordPress website and you don’t want your visitors to be able to access your website at that time. These can be plugin installations, theme changes, or migration of your website.

Whatever the need is you can put your website on maintenance mode and show a custom page to your visitors.

Why would you need to set up maintenance mode?

While you can make small changes to your website without your visitors finding out about it. There are many instances when you are making major updates to your website. During the update process if anything goes wrong you don’t want your visitors to see an error page.

The updates can also be time-consuming and there can be many things that might not work for that time period. Instead of letting your visitors see the broken website, it is best to put your website on maintenance mode. Failing to do so can lead to bad user experience for your visitors. This is especially amplified when it is a high traffic website.

Set up maintenance mode on your WordPress website using a plugin

A plugin makes it very easy for you to turn on the maintenance mode on your website. It also allows you to add the functionality without editing any line of code. WP Maintenance Mode is a great plugin for the job.

  1. Install and activate the plugin.
  2. Visit Settings -> WP Maintenance Mode from your admin dashboard.
  3. Here you can configure from an array of settings.
  4. To turn on the maintenance mode you simply have to click on the Activated checkbox under the Status.
  5. You can also edit the other settings according to your requirements and once done click on the Save settings button.

The design tab allows you to customize the maintenance page as per your needs.

Set up maintenance mode using a function

If you don’t want to use a plugin then you can add a custom function to your functions.php file on your WordPress website.

Edit the functions.php file of your theme and add the below lines of code at the bottom.

function maintenance_mode(){
if( !is_user_logged_in() ){
wp_die('<h1>Maintenance is On</h1><br />Please visit after some time.');
add_action( 'init', 'maintenance_mode' );

Once saved, your website should now be showing the maintenance mode for anyone who is not logged in.

In The End

It is very important that you make big changes to your website with the maintenance mode turned on. Not doing so can be a bad user experience for your visitors. If you want the option to turn on maintenance mode with ease then using a plugin is the best option.

Have questions or confused about something WordPress Related? Join Our Discord Server & ask a Question

Leave a Comment

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

Scroll to Top
Scroll to Top