Putting your WordPress site into maintenance mode is a smart way to notify all visitors that your website is temporarily down for an update. Whether you’re performing updates, fixing issues, or redesigning your site, maintenance mode ensures that your website visitors see a message for broken pages.
In this blog, we’ll explore how to easily enable maintenance mode on a WordPress website, why it’s important, and some best practices for WordPress developers.
What is the Maintenance Mode on a WordPress website?
Maintenance mode is a temporary state that lets your site visitors know that the website is undergoing updates, changes something, or adds something. Instead of allowing visitors to see an unfinished or broken website, WordPress displays a maintenance page or message that keeps users informed.
Why Use Maintenance Mode for Your Website:
- Updating WordPress Core, WordPress Plugins, or WordPress Themes: These updates can sometimes temporarily break your client or personal site.
- Site Redesign: If you’re redesigning your layout or adding new features, it’s best to hide the work-in-progress for security purposes.
- Bug Fixes: Put your site into maintenance mode while fixing WordPress critical errors.
- Performance Tweaks: Testing and optimizing WordPress sites without affecting live users.
Here’s how to activate maintenance mode on a WordPress website.
Method 1: Using a WordPress Plugin
Using a WordPress plugin is the easiest way to enable maintenance mode. Here are two highly recommended plugins:
- WP Maintenance: This free plugin lets you customize your maintenance page, set a countdown timer, add countdown , add any image, and even add social media links.
- SeedProd: A premium plugin that offers more advanced customization options, including a drag-and-drop builder.
Steps to Enable Maintenance Mode with WP Maintenance Mode:
1. Go to your WordPress dashboard.
2. Navigate to Plugins > Add New.
3. Search for WP Maintenance and install it.
4. After activation, go to WP Maintenance. You will see this on your dashboard.
5. Customize the maintenance page by adding text, images, or a countdown.
6. Switch the Status to Activated and save your changes.
Once activated, your visitors will see a maintenance page while you continue to work on this website.
Method 2: To manually turn on maintenance mode, use custom code.
If you prefer not to use any wp plugin for this, you can enable maintenance mode manually by adding some code to your functions.php file. Access the file into your wp dashboard. Flow this step:
- Go to Appearance > Theme File Editor.
- Click the “I understand” button.
- Then go to functions.php file.
- Then pest this code under this file.
Code to Add in functions.php:
function wp_maintenance_mode() {
if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
wp_die('<h1>Website Under Maintenance</h1><p>We are currently performing scheduled maintenance. Please check back soon.</p>');
}
}
add_action('get_header', 'wp_maintenance_mode');
All steps done. This is how you appear when you are a visitor:
This code checks if the user is logged in as an administrator and allows only admins to access the site, while showing a maintenance message to others.
Best Practices for Show Maintenance Mode
1. Customize the maintenance page.
Adding custom text, branding, or even a countdown timer can improve the user experience. Let visitors know when they can expect the site to be back online.
2. Install a Redirection or Countdown Timer plugin.
Using a plugin like SeedProd, you can set up a countdown timer or redirect visitors to another page (such as your blog website or social media) while the main site is under maintenance.
3. Test in private mode.
Always test the maintenance mode by opening your site in an incognito or private browser window. This will show you exactly what non-logged-in users interface with.
4. Notify search engines.
To prevent search engines from indexing your maintenance mode page, ensure your plugin or code includes a no-index meta tag. Plugins like WP Maintenance automatically handle this.