How To Put Your WordPress Site On Maintenance Mode

WordPress Maintenance Mode is a state you can put your site in, incase you have to perform refreshes, make changes to the site, or fix a security bug.

Maintenance mode wordpress
Maintenance mode wordpress

There are alot of reasons why you might want to put your WordPress site on maintenance mode. In this article we are going to cover the following :

  • What is WordPress Maintenance Mode
  • Purpose for using WordPress Maintenance Mode
  • How to put your WordPress site on maintenance mode

What is WordPress Maintenance Mode?


As stated earlier WordPress Maintenance Mode is a state you can put your site in, incase you have to perform refreshes, make changes to the site, or fix a security bug or to take care of some administrative issues on your site.

Purpose for using WordPress Maintenance Mode

There are three major purposes why you may want to put your site on maintenance mode, they are ;

  • You want to make changes to the site design, content or WordPress theme.
  • You want to fix a security bug that could affect your users files.
  • A coming soon site which relates to new sites which usually helps to hype the yet to launch site.

How to put your WordPress site on maintenance mode

There are three most common ways by which you can put your WordPress site on maintenance mode

  • Use a WordPress Maintenance Mode plugin.
  • Adding a code to display a maintenance page.
  • Through your .htaccess file

Each of these methods execute maintenance mode in various ways.

So, let’s talk about them…

Use a WordPress Maintenance Mode plugin

There are several types of wp plugin that does this, but I will recommend maintenance by wp maintenance because of their amazing features. Download the plugin here. Upload it to plugins on your WordPress site after which you have to activate the plugin. With this plugin you have the options to change the background image,page title,headline, description, footer text, also to set logo,set logo width and height,page preloader image, background colour and many more. So you see why I recommended it.


Adding a code to display a maintenance page.

If you want to put your site on maintenance mode without using plugin, then you can add these set of codes to your function.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/>Something ain’t right, but we’re working on it! Check back later.’);
}
}
add_action(‘get_header’, ‘wp_maintenance_mode’);

It enforces your site into maintenance mode and displays the message you wrote in-between the H1 tag.

Through your .htaccess file

For this approach it is necessary to have permission to edit the .htaccess file on your server. This file can be found in the root directory of your website. Once you have this file opened, copy and paste the following code:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^123.456.789.123
RewriteCond %{REQUEST_URI} !^/maintenance.html$
RewriteRule ^(.*)$ https://example.com/maintenance.html [R=307,L]


This code will redirect all web requests coming to your homepage to a maintenance.html file that you will have to create first, as you will be using it as a temporary homepage replacement. You can find many simple maintenance page HTML templates online. Pay close attention to the %{REMOTE_ADDR} part, which is where you have to replace the numbers with your own IP address, as this will allow you to access the site no matter what.

With this now, I know you must know How To Put Your WordPress Site On Maintenance Mode isnt It?

We want to hear from you. What are some of your reasons for using WordPress maintenance mode, and what are your favorite ways of implementing it? Let us know in the comments below!

1 Trackback / Pingback

  1. How to find all 404 errors on your website - Mynaijatech

Leave a Reply

Your email address will not be published.


*