How To Put Your WordPress Site In Maintenance Mode: An Easy Guide

How To Put Your WordPress Site In Maintenance Mode Easy Guide

Do you want to put your WordPress website in maintenance mode?

When running a WordPress website, most business owners are trying to get involved in search engines. The higher your site ranks, the more visible it is. As a result, you can receive a lot of traffic.

In fact, there may be times you need to temporarily shut your site down for a couple of reasons without losing traffic. Firstly, your website gets hacked, so you don’t want to create an unpleasant user experience. Making changes to the site design is also worth taking it off.

You can take various actions, from discouraging search engines from indexing your WordPress site to using a private site plugin to stop users from accessing it. Have you ever heard of maintenance mode? This proves one of the most effective solutions to prevent users from viewing your unavailable site while allowing you to work on it behind closed doors.

To help you understand as well as apply this useful method effectively, we’ll briefly explain what WordPress maintenance mode is and when to set it for your site. Then, read on four ways to enable it for your WordPress site.

Let’s hop to it!

WordPress Maintenance Mode: What It Is?

WordPress maintenance mode refers to the status put on your site that disables users’ access to any pages and posts on your website. Instead, they will see a user-friendly notice saying that the website is not available for some time.

For example: “Domain.com is undergoing scheduled maintenance. Sorry for the inconvenience” or “Maintenance mode is on. The website will be available soon”.

Under Maintenance Mode

WordPress uses the wp_maintenance function in the backend and creates a “.maintenance” file to keep displaying the maintenance message. This file will be removed once the maintenance process completes.

The maintenance mode allows you to make changes to your site without affecting the user experience. Only specific users like admins, editors, or developers have access to the website during this period.

When to Apply Maintenance Mode to Your WordPress Site

Anytime you perform minor tweaks on your site, such as publishing content, building a new landing page, or freshening images, putting the entire site in maintenance mode is unnecessary. 

Why do you need Maintenance Mode for Your WordPress Site

[addtoany buttons=”facebook,twitter,pinterest” media=”https://cyberchimps.com/wp-content/uploads/2023/08/Necessity-of-a-Maintenance-Mode-for-Your-WordPress-Site.webp”]

However, you’re required to take immediate action when these situations happen:

  • Update your site design.

Are you planning to re-design your whole website?

Not as simple as updating the design of a landing page. You have to consider many things, from choosing a suitable theme, copying snippets from your current theme to testing load time, and keeping tracking code.

Rather than granting visitors access to a broken site or incomplete work, you should close it for a while. You can also put a countdown timer on the maintenance page, letting them know when the site is back.

  • Fix a major bug

What if someone hacks your WordPress website, and you want to stop any other threats? While you’re solving these security issues, what if visitors land on your site and see it’s broken? They would probably not come back next time.

Activating maintenance mode comes in handy in this case. It gives you time to analyze where the malware comes from, contact the hosting providers, and back up all the files on your server.

  • Focus on other endeavors.

Your business or website is not performing very well, so you intend to ship to another area.

Instead of deleting the entire website, you should wisely put it in maintenance mode to save time and effort when coming back and working on it later.

4 Ways to Enable Maintenance Mode for WordPress Site

You can select different options to create a compelling WordPress maintenance page. Tech-savvy who are familiar with coding and site development prefer to enable this mode through the .htaccess or functions.php file. Others seek help from third-party plugins, such as a specialized maintenance mode plugin or even an entire site password protection one.

1. Use a Custom Function

Manually adding a code to your functions.php file allows you to show a basic maintenance page on your site.

Follow these four steps to creating a simple maintenance notice:

Head to Appearance →Theme File Editor in your WordPress dashboard

Appearance < Theme File Editor

Choose the functions.php file in the Theme Files menu.

Theme Files < functions.php

Enter this code at the end of your theme’s fucntions.php file.

// Activate WordPress Maintenance Mode
function wp_maintenance_mode() {
    if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
        wp_die( '<h1>Under Maintenance</h1><br>Website under planned maintenance. Please check back later.' );
    }
}

add_action( 'get_header', 'wp_maintenance_mode' );

Update the file.

Update File

Once the theme file is updated, this message will display on your site:

Under maintenance mode message

It’s possible for you to customize the message “Website under planned maintenance. Please check back later.”.

2. Enable Maintenance Mode Through Your .htaccess File

Another manual solution to enable maintenance mode on your WordPress site is via the root directory at the webserver level.

Open your .htaccess file and enter this code there:

RewriteEngine On

RewriteBase /

RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.123

RewriteCond %{REQUEST_URI} !^/maintenance\.html$

RewriteRule ^(.*)$ https://example.com/maintenance.html [R=307,L]

Any access, even to the admin dashboard, will be restricted. To avoid unexpected errors, you should back up your .htaccess file before editing it.

Remember to replace “123\.456\.789\.123” with the IP address of those who need access to your site.

3. Use a Maintenance Mode Plugin 

Thousands of free plugins support maintenance page creation available on the WordPress repository.

WP Maintenance Mode turns out to be one of the most popular solutions, with over 700 thousand active installations and a 4.3-star rating.

WP maintenance mode

The plugin lets you create a user-friendly maintenance screen for your site. Only admins or authorized users can access the blog from the front and back. Whenever landing on any pages on your site, users will see this:

Maintenance mode

Follow these four steps to get started with the plugin:

Add New Plugin

Type “wp maintenance mode” in the search box.

WP Maintenance Mode

Install and activate the plugin.

Head to Settings in your WordPress sidebar and choose LightStart.

Settings < LightStart

In the General settings tab, you need to:

  • Activate or deactivate the maintenance mode via the Status option.
  • Enable Search Engine crawling and indexing with the Bypass for Search Bots feature. 
  • Select roles in Backend Role and Frontend Role sections to grant users access to your blog. The default whitelisted role is Admin. 
  • Enter a URL in the Redirection box to turn users over to a different page on your site after login.
  • Make specific pages on your site, such as login pages or WordPress feeds, available. 
General settings

Move to the Design page to customize your maintenance page’s appearance.

Design settings
  • Select a page where you want to display your “under maintenance mode.”
  • Pick a template for your maintenance page. You can also customize them according to your choice.

The Modules section differentiates your maintenance page from standard ones by including a subscription box and Google Analytics tracking.  

Modules settings

Select Yes for which options you would like to display, then fill in the settings under each main section. 

4. Use a Password Protection Plugin

Primarily coming as a content password protection plugin, Password Protect WordPress Pro permits you to secure your entire website and activate the maintenance mode in a different path. 

Password protect WordPress

You might wonder how a plugin locking content with passwords can put your site in maintenance mode.

Once protected, your entire website will be covered with a password form saying that the site is currently under development.

Only specific users with the correct password can open and view the website’s front end. They’re not required to log in with both emails and passwords like other maintenance mode plugins.

To activate maintenance mode using PPWP Pro, install it on your WordPress site, customize the password form message, and set a password.

Here is how we break the process into steps:

Download the PPWP Pro plugin

Go to Plugins → Add New in your WordPress navigation menu.

Add new plugin

Choose the plugin’s zip file after clicking Upload Plugin.

Upload Plugin

Visit the plugin Settings page.

Edit the password form message in the PASSWORD FORM section. You can change the default one to “The website is under maintenance. Please enter the correct password to view it”.

Password form customization

Save your changes.

Visit the Entire Site tab and turn on the Password Protect Entire Site feature.

Password protect WordPress

Enter your password. You can set multiple passwords. Each must be displayed on a separate line.

Click Save Change

The website is temporarily shut down and has become private now. Only team members, including editors or web designers with the correct passwords, are able to open it.

Want to exclude some pages from maintenance mode selectively? Switch the “Exclude these pages and posts from site-wide protection” button and search for your desired pages. The excluded content will remain accessible to the public, while the rest of the website will be private.

What to Do When Your Website Gets Stuck in Maintenance Mode

Your website sometimes gets stuck in maintenance mode even though you’ve deactivated this status. To fix it, you need to connect to your server via FTP and delete the “.maintenance” file. You should also clear the cache on your WordPress site.

Besides fixing the maintenance mode errors, you ought to take these two tips to prevent unwanted stuck in the future as well:

  • Avoid updating all plugins at once. When you get new versions of multiple plugins at the same time, your site might be closed due to several unknown conflicts between plugins and themes. It’s recommended to click Update for an individual plugin at a time.
  • Ensure that all the plugins and themes you install have been tested and should be compatible with the latest version of WordPress. You can confirm this in your WordPress dashboard.

Which Is Your WordPress Maintenance Mode Solution?

A site undergoing maintenance makes it easy for you to work on without losing traffic and affecting the user experience.

Visitors can subscribe to receive the latest information about when the live site comes back. They’re able to follow social networks while the live site is unavailable too.

You can apply different methods to temporarily shut your site down, both manually or using a plugin. With the first solution, remember to back up your theme file or .htaccess file in the directory when making any changes there.

Want to simplify the process? Just install the WP Maintenance Mode or Password Protect WordPress Pro plugin. While the former authorizes you to design stunning maintenance screens and put a countdown timer there, the latter seems more suitable for websites planning to provide premium content.

You can lock the website for maintenance. And when it’s live, you can use that same plugin to protect private pages and posts.

Conclusion

We hope this article helped you learn how to put your WordPress site in maintenance mode.

If you liked reading this content, don’t forget to check our other similar articles:

If you still have a burning question about how to put your WordPress site in maintenance mode. Just say the word in the comment box below.

Want to build a Wordpress Website? Grab the Responsive theme now!

Facebook
Twitter
LinkedIn
WhatsApp

Disclosure: This post contains affiliate links. That means if you make a purchase using any of these links, we will earn a commission without any extra cost to you. Thanks for your support.

Leave a Reply

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

*

Ready to Launch Your Website?

Ready to built your business website with the fast and fully customizable website templates? Get started for free and extend the settings with easy affordable plans.

Top

Grab Flat 20% Off On All Plans - Limited Time Offer! 🥳 🎉