Skip to main content

Whenever you are trying to do any changes or updates on your WordPress site, it is important to set your site to maintenance mode. If the maintenance mode is not set, then the user will be displayed with a broken site throughout the maintenance process. A broken site may result in reducing the site rank and traffic, so it is important to know how to enable Maintenance mode on your WordPress site to avoid discomfort to the visitor of your website.

Also, read How to Get an SSL Certificate for your WordPress website

Why Maintenance Mode?

The most common reasons for maintenance mode are,

  • Switching between themes
  • Adding and testing plugins
  • Backend technical improvements
  • Something else important on your site

Built-In Maintenance Mode

WordPress has its own maintenance mode by default. This feature doesn’t need anything to be configured and you need to do anything from your side. WordPress automatically displays the maintenance mode message every time a plugin, theme, or core file is updated. WordPress automatically creates a .maintenance file in the website’s roots during installation. So it displays the message to anyone approaching the site during an update.

The feature is so useful that once the update is complete the site goes back to its normal state displaying the content. This method is helpful only for smaller updates like plugin and theme updates, but for major site upgradation, you need to look into other methods where you could actually work in your frontend when an update is in progress.

Ways to Add Maintenance Mode in WordPress

There are three possible ways to activate Maintenance Mode on your WordPress activation site.

  • Maintenance Mode Without Plugin
  • Maintenance Mode With Plugin

Add Maintenance Mode Without Plugin

Without Plugin, you can be able to enable Maintenance mode and this involves basic knowledge of coding and we are here to make that simple for you. Also without a plugin, there are two possible ways

  • Via Theme Editor
  • Via .htaccess file

Via Theme Editor

Before performing any changes on your Theme editor, make sure to have a complete backup of your WordPress site and Data.

[1] From your WordPress dashboard, go to Appearance >> Theme Editor.

Theme editor
[2] Choose function.php file from the Theme files section.

WordPress Maintenance Mode
[3] Add the following code snippet in the function.php file.

// Activate WordPress Maintenance Mode
function wp_maintenance_mode() {
if (!current_user_can('edit_themes') || !is_user_logged_in()) {
wp_die('<h1>Site Under Maintenance</h1><br/>
Website under maintenance.Check out later.');
}
}
add_action('get_header', 'wp_maintenance_mode');
[4] Save the change to activate Maintenance mode on your site.

To view the change, you need to log out from your WordPress and visit the site or just check it out using some other web browser and this will redirect you to the WordPress maintenance mode page. Once the maintenance is done, remove the code snippet from the function.php to disable WordPress Maintenance mode and get your site back online.

Via .htaccess file

[1] From the cPanel, go to File manager.

File manager
[2] Open the public.html folder and choose the .htaccess file.

WordPress Maintenance Mode

Note: If you can’t find those files, click on Settings and check the Show hidden file box to view it.

WordPress Maintenance Mode
[3] Right-click on the file and choose rename option to rename the file to .htaccess_default.

[4] Create a new .htaccess file and right-click on it.

[5] Choose Edit from the context menu.

edit
[6] Enter the following line of code in the file.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maintenance.html$
RewriteRule ^(.*)$ https://example.com/sitemaintenance.html [R=307,L]
[7] Click on Save changes to apply the change to your WordPress site.

save changes
[8] Now get back to the web directory and create a file name sitemaintenance.html.

[9] Add the maintenance page message to be displayed on the page.

[10] Now you have successfully activated the maintenance mode on your website.

The Maintenance mode does not work if you made any errors in the code. So be careful on adding or pasting the code snippet on your WordPress site.

Add Maintenance Mode With Plugin

There are several plugins available on the WordPress theme store using which you can use to activate Maintenance mode on your site. Some of the popular plugins which you can try are

  1. WP Maintenance Mode
  2. Elementor Website Builder
  3. Coming Soon Page & Maintenance Mode by SeedProd
  4. Coming soon and Maintenance mode
  5. Minimal Coming Soon & Maintenance Mode – Coming Soon Page
  6. Under Construction and many more

Using any of these plugins, you can simply add a maintenance page for your WordPress site just by drag and drop You can also make your maintenance page more effective by adding Notify me after maintenance, remaining time, social media handles to check out, etc.

Here are some of the example templates and ideas for a maintenance page look.

WordPress Maintenance Mode

maintenance page

maintenance page

Check our list of 22 Best Free Themes For WordPress [Expert Review] 2022

Conclusion

These are some of the possible ways to add maintenance mode on your WordPress site. Apart from the above-mentioned methods, some WordPress themes or editors like Elementor even come with a Maintenance mode page in-built which you can activate just by turning on the toggle. We hope this guide helps you find how to add a maintenance page to your WordPress site. If you have any queries, make use of the comments section below. For more WordPress-related guides and articles, explore our blog.

Leave a Reply