maintenance
GuideWordpress

WordPress Maintenance Mode : How to Activate it?

To maintain a website current and working, regular maintenance is required. To prevent having a broken website online, you might need to put your website in maintenance mode to make changes to the back end or revamp the front end. In this article, we will show you how we can activate WordPress maintenance mode.

The .maintenance file that carries the message is created using the wp maintenance function in WordPress maintenance mode. When the building is finished, you can instruct WordPress to remove the maintenance file, and your website will resume normal operation.

A website is placed in WordPress maintenance mode when modifications are being performed that could possibly break it.

When your WordPress site is live, you can make these small adjustments, including updating or publishing content. To avoid negative perceptions, it’s advisable to take it offline if you’re working on more substantial modifications.

A WordPress site may not operate correctly or possibly appear broken while undergoing maintenance. Customers might question the website’s security or credibility as a result, which could have a detrimental effect on future traffic. We want to avoid any bad impression by creating a good looking maintenance page.

Here are few ways you can create a maintenance page on WordPress. When typing the word “maintenance” on the WordPress Plugin page, you will find several plug-ins that would create a good looking maintenance page for you.

WordPress Maintenance Mode
WordPress Maintenance Plugin

Using LightStart to Enable WordPress Maintenance Mode

One of my favorite is the LightStart plugin. It doesn’t just support maintenance page, it also supports a “coming soon” and “landing” page. Once install, you could easily choose a template for the maintenance page. You can download plugin this by searching “lightstart” under the plugin page.

maintenance template
Free Template

Once you chose a template, it will redirects you to the maintenance edit page where you can make adjustments on the template. It is also automatically helped you to set your site in maintenance mode. When you visit your page with the maintenance mode on, you will only see the maintenance page and not able to browse the other pages.

Using SeedProd Plugin to Enable WordPress Maintenance Mode

The other good plugin is using SeedProd. This plugin also supports “coming soon” and “landing” page. Once install, you will be able to choose your favorite template for all types of pages. Download here : https://wordpress.org/plugins/coming-soon/

SeedProd maintenance
SeedProd

It is easy to setup and apply maintenance mode on your site using these plugins. However, if you do not want to use plugin to activate maintenance mode you may edit the files on WordPress. You might need some programming or some technical skills to do this.

Editing Function.php File

Editing the function.php file is dangerous and not advisable. You may want to backup your function.php file or copy and paste the whole content in another file on your local PC.

function.php
function.php

Under appearance, click the “Theme File Editor” and choose “function.php” under theme files. Once selected, you will see the whole content of your function.php file. Add the following code at the bottom of the file.

function wp_maintenance_mode() {
	if (!current_user_can(‘edit_themes’) || !is_user_logged_in()) {
		wp_die(‘<h1>Under Maintenance</h1><br />Please check back later.);
	}
}

add_action(‘get_header’, ‘wp_maintenance_mode’);

Once you click “Update File” at the bottom, you will see the maintenance message when you visit your site. Using this method, it looks more plain since you will only see the Under Maintenance message with a white background.

There’s another method which requires you to login to your site using FTP and modify one of your files.

Editing the .htaccess File

Having some technical or programming skill might be useful for using this method. You may need to login and access your files using a file manager. Additionally, altering the .htaccess file could be risky since if you make any mistakes or change any other contents, your website might crash. Remember, always create backup of these kind of files in case if anything bad happen.

Changing the file content into something similar like below will redirect your site to the maintenance page.

RewriteEngine On

RewriteBase /

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

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

The Best Way ?

Using a plugin is always going to be the best option. You don’t have to change your files, and it is secure and simple. However, there are always advantages and disadvantages. The features may be restricted by a plug-in, and you may need to pay for additional or more features.

While manually editing your own files on WordPress may be risky, it may also allow you more flexibility. However, if you’re technically competent and know what you’re doing, you can always manually construct the template you want.