Performing updates or making changes to your WordPress site? Putting your site into maintenance mode is crucial to avoid any issues for your visitors during this process. In this comprehensive guide, we’ll cover everything you need to know about activating maintenance mode in WordPress.
Table of Contents
What is Maintenance Mode?
Maintenance mode is a temporary placeholder page that gets displayed to visitors when you need to perform backend updates, install new plugins/themes, or make design changes to your site.
Instead of showing errors or broken pages, the maintenance page lets visitors know your site is down temporarily and will be back shortly.
When Should You Use Maintenance Mode?
Here are some common reasons for enabling maintenance mode:
Making Major Edits
If you’re performing a site-wide redesign, switching themes, modifying page layouts, etc., put your site in maintenance mode. This ensures visitors don’t see half-finished pages.
Updating Plugins and Themes
When updating WordPress core, plugins or themes, it’s good practice to enable maintenance mode. The updates can sometimes cause conflicts that display errors to visitors.
Transferring Hosts
Switching web hosts or migrating from localhost to live server? Activate maintenance mode to prevent access during the transition process.
Fixing Technical Issues
Is your site experiencing glitches or sudden spikes in traffic that’s slowing it down? Throw it into maintenance mode temporarily.
How to Enable Maintenance Mode in WordPress
There are two easy ways to activate the maintenance mode — using a plugin or by adding code to your theme’s functions.php file.
Method 1: Using a Plugin (Easiest Method)
We recommend using a dedicated maintenance mode plugin as it handles all the coding for you with just a few clicks.
Here are some popular options:
- SeedProd – Comes with beautiful templates and lets you easily customize design.
- WP Maintenance Mode – Offers countdown timer, Google Analytics integration, etc.
- Maintenance – Lightweight plugin with basic maintenance page.
Once installed and activated, head to the plugin settings to enable maintenance mode. Some plugins may also allow scheduling a date/time.
Method 2: Adding Code to functions.php
If you prefer not to use a plugin, you can manually add the following code to enable maintenance mode:
// Add this in your theme's functions.php file
add_action('get_header', 'enable_maintenance_mode');
function enable_maintenance_mode() {
if (!is_user_logged_in()) {
wp_die('<h1>Site Under Maintenance</h1><br />Please check back later!');
}
}
This displays a basic message for non-logged in visitors. You can customize the content as needed.
Customizing Your Maintenance Page
Most plugins provide customization options for your maintenance page design. Here are some tips:
- Match Branding – Use logo, brand colors/fonts to match your site’s look
- Communication – Clearly explain why site’s down and when it’ll be back
- Contact Details – Allow visitors to reach you via contact form, email, social media etc.
- Countdown Timer – Display a timer showing when maintenance will finish
- Images/Graphics – Include relevant images so page isn’t too boring
Allowing User Access During Maintenance
You may want to allow search engines and certain user roles to bypass the maintenance page.
For example, allow access for:
- Search bots so they can still index your site for SEO
- Administrators to manage and publish content
- Editors to add posts and review site during maintenance
Refer to your maintenance plugin’s settings for options to exclude specific IPs, user roles, etc.
Best Practices for Maintenance Mode
Follow these tips to ensure everything runs smoothly:
- Choose off-peak timings – Avoid peak traffic times to minimize disruption
- Keep it brief – Complete maintenance quickly and restore site ASAP
- Test thoroughly – Test site performance before and after making changes
- Announce on social media – Inform visitors of maintenance schedule
And that’s it! By putting your WordPress site in maintenance mode before making major changes, you can avoid a poor experience for your visitors.