How to Set Your WordPress Site to Maintenance Mode (Two Different Methods)

HomeWordPressHow to Set Your WordPress Site to Maintenance Mode (Two Different Methods)

How to Set Your WordPress Site to Maintenance Mode (Two Different Methods)

There are some possibilities that make you want to set your WordPress site to maintenance mode. You might want to redesign it, applying a new server configuration trick to speed up your site, or fixing some buggy features. Whatever the change you want to make, your idea to set your website to maintenance mode is great for two main reasons:

  • It lets your visitors know that your website is temporarily offline so they can come back later once your site goes back online.
  • Setting your website to maintenance mode allows search engines to know that your site is temporarily down by sending a temporary maintenance response (HTTP 503).

The second reason is especially crucial if you rely on SEO to gain traffic. By telling search engines that your site is under maintenance, your website SEO won’t be affected by the downtime during the maintenance period.

How to set your WordPress to maintenance mode

WordPress actually has a built-in maintenance mode function. However, it only works when you make a new change to your site such as installing a new theme or plugin, updating a theme or plugin, and updating the WordPress core. You will find no option to enable the function from the WordPress dashboard. There are at least two ways to set your WordPress site to maintenance mode:

Method one: by using a custom function

The first method you can use to set your WordPress site to maintenance mode is by adding a custom function to your site. You can do so by editing the functions.php file of the theme you use. From your WordPress dashboard, go to Appearance -> Theme Editor. If you can’t find this menu, make sure that the Theme Editor is not disabled.

Select the functions.php file on the right panel to edit it and add the following script to add the new function.

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');

If you have no idea where to place the code above, you can simply place it to the bottom side. Here is the example of the placement. Click the Update File button to apply the new change.

Method two: by using a plugin

If you want to create a more eye-catching maintenance page (without coding), you can use a plugin to ease your job. There are a bunch of WordPress maintenance plugins you can use. One of our recommendations is Elementor.

Elementor itself is basically a page builder plugin, but it has a feature to set your site to a maintenance mode and coming soon mode. This feature is available on both Elementor Free and Elementor Pro. You can download the free version of Elementor on the WordPress plugin directory. Simply install and activate the Elementor plugin to use it.

Before being able to use Elementor to set your WordPress site to maintenance mode, you need to create a template first. To do so, go to Templates -> Add New to create a new Elementor template. Set the template type to Page and give it a name. Click the CREATE TEMPLATE button to start creating the template.

You can either create the template from scratch or from a premade template. In this example, we will create the template from a premade template. If you are new to Elementor and want to create the template from scratch, you can read this guide to learn how to use Elementor.

Since we want to create the template from a premade template, click the folder icon on the canvas area to open the template library.

Search for a premade template you want to use. To ease your job, you can use the search feature. Click the INSERT button to import the premade template.

You can go to the left panel to customize the page or change the default content. Again, you can read this guide to customize your page design if you are new to Elementor. Click the PUBLISH button on the bottom side on the left panel once you are done editing the page.

Switch back to the WordPress dashboard (you can click the hamburger icon on the top-right corner on the left panel). Go to Elementor -> Tools and open the Maintenance Mode tab. On the Choose Mode option, select Maintenance and select the template you have just created on the Choose Template option. You can also set who can access your site during the maintenance on the Who Can Access option. Click the Save Changes button.

That’s it. Your site is now under maintenance mode. To have your website back online, you can simply go back to the Elementor -> Tools and set the Choose Mode under the Maintenance Mode to Disabled.

hand-picked weekly content in your inbox


related posts


Please enter your comment!
Please enter your name here