How to create and install a maintenance mode page on wordpress

Estimated Reading Time: 3 min

Rate this post
To set up a maintenance mode page on WordPress, you can either use a plugin or manually create the functionality. Here’s a step-by-step guide for both methods:

Method 1: Using a Plugin

1. Install a Maintenance Mode Plugin

  • Go to your WordPress Admin Dashboard.
  • Navigate to Plugins > Add New.
  • Search for “Maintenance Mode” plugins. Popular options include:
  • Click Install Now and then Activate.

2. Configure the Plugin

  • After activation, go to the plugin’s settings page (usually under Settings > Maintenance Mode or in a new menu item).
  • Customize your maintenance page:
    • Add a title, description, and message for users.
    • Add a background image or logo.
    • Configure visibility (e.g., allow administrators to bypass the maintenance mode).
    • Set up additional features like countdown timers or social media links.

3. Enable Maintenance Mode

  • In the plugin settings, toggle the Enable Maintenance Mode or similar option.
  • Save your changes, and the maintenance page will be live for visitors.

Method 2: Manually Create a Maintenance Mode Page

If you prefer not to use a plugin, you can create a maintenance mode manually by adding a PHP snippet to your theme.

1. Edit the functions.php File

  1. Log in to your WordPress Admin Dashboard.
  2. Go to Appearance > Theme File Editor.
  3. Select the functions.php file from your active theme.

2. Add the Maintenance Mode Code

Insert the following code at the end of your functions.php file:

function custom_maintenance_mode() {
    if (!current_user_can('edit_themes') || !is_user_logged_in()) {
        wp_die(
            '<h1>Website Under Maintenance</h1>
            <p>Our site is currently undergoing scheduled maintenance. We will be back shortly. Thank you for your patience!</p>',
            'Maintenance Mode'
        );
    }
}
add_action('get_header', 'custom_maintenance_mode');

3. How It Works

  • Visitors who are not logged in as administrators will see the maintenance message.
  • Logged-in administrators can access the site normally.

Optional: Custom Maintenance Page Design

To create a more visually appealing page:

  1. Save an HTML file as maintenance.html in your theme directory (e.g., wp-content/themes/your-theme/).
  2. Replace the wp_die() function in the code above with this:
function custom_maintenance_mode() {
    if (!current_user_can('edit_themes') || !is_user_logged_in()) {
        include(get_template_directory() . '/maintenance.html');
        exit;
    }
}

Method 3: Enable WordPress Native Maintenance Mode

When WordPress performs updates, it automatically enables a basic maintenance mode. You can manually create this by adding a .maintenance file to the root directory of your WordPress site.

Steps:

  1. Create a file named .maintenance in the root folder of your WordPress installation.
  2. Add the following PHP code inside the file:
<?php
$upgrading = time();
echo "The site is currently undergoing maintenance. Please check back soon!";
  1. Save and upload the file to your server.

How to Disable Maintenance Mode

  • For Plugins: Go to the plugin settings and toggle off the maintenance mode.
  • For Manual Code: Remove the added code from functions.php or delete the .maintenance file.

Let me know if you’d like help customizing a specific maintenance mode design or functionality!

Photo of author

Flora

How to create and install a maintenance mode page on wordpress

Published

I am Flora, the publisher and founder of *Be-Smart*, a platform dedicated to sharing insights and inspiration for living a fulfilling life. With a strong background in the web, my goal is to empower people to genuinely recognize and celebrate admirable actions big or small in themselves and others.