4 Easy Ways to Enable WordPress Maintenance Mode
Bulletproof Backups for Your WordPress Website
Fortify your business continuity with foolproof WordPress backups. No data loss, no downtime — just secure, seamless operation.
You have a WordPress site that you’re really proud of. It’s where people come to learn about your content or buy your products and services. Now, think about what would happen if you made big changes to your site and visitors saw a messed-up version of it. Not good.
When you update your site without a safety net, you risk exposing an unfinished or broken site to your visitors. Nobody likes a glitchy website, and once people get a bad first impression, it’s hard to win them back.
This is where maintenance mode comes in! Maintaining a WordPress site effectively means ensuring it runs smoothly, and For this, we’ve tested the best ways to use it. Additionally, we will show you how to activate and deactivate it smoothly. This way, you can update your site without any interruptions, keeping your visitors happy and your site running perfectly.
TL;DR: The safest way to put your site into maintenance mode for a certain amount of time is by using a dedicated plugin like LightStart. While the other manual approaches are effective, they aren’t without risks. Whatever you do, ensure you backup your site using a reliable plugin like BlogVault.
Understanding WordPress maintenance mode
When you update any plugin, theme, or even the core on your WordPress site, it automatically enters maintenance mode for a short time. This is to make sure your visitors don’t see any broken pages or unfinished features during these updates.
In maintenance mode, anyone visiting your site will see a message that says, “Briefly unavailable due to scheduled maintenance. Check back in a while“This informs them that the site is undergoing maintenance and will be back shortly.
However, you cannot control how and when the maintenance mode appears on your site from wp-admin. You need plugins to do that.
You can specify the type of maintenance and provide an estimated time for when the site will be available again, reassuring your visitors that the downtime is planned and temporary. Some plugins even let you customize the ‘under construction’ message.
Meanwhile, you, as the administrator, can still access the backend of the site. This allows you to work on updates without worrying that visitors might see a broken or unpolished version of your site.
Methods to enable WordPress maintenance mode
Sometimes, the automatic WordPress maintenance mode might not get triggered. This can happen due to several reasons like server issues or an unstable internet connection. Here are some tried-and-tested methods to put your site into maintenance mode.
Before you start making big changes to your WordPress site, it is always a good idea to take a backup of your entire site. This ensures you can recover your site if something goes wrong.
A) Using a plugin [RECOMMENDED]
The safest and easiest way to enable maintenance mode is by using a plugin. Plugins like LightStart can help you do this with just a few clicks. Once installed and activated, you can easily configure the settings to:
- Activate maintenance mode with ease.
- Customize the maintenance message to visitors.
- Ensure that only administrators can access the backend for updates.
This method is highly recommended because it minimizes the risk of errors, saves time, and offers a much more user-friendly experience both for you and your visitors. Plus, it keeps your site looking professional and well-maintained.
Alternative plugins you can use
B) Adding the .maintenance file via FTP
An alternative way to enable maintenance mode is by adding a .maintenance file directly through FTP. This method requires using an FTP client like FileZilla to connect to your website’s server. Here’s how you can do it:
1. Connect to your server: Use an FTP client like FileZilla to connect to your website’s server. You’ll need credentials from your hosting provider to do this.
2. Find the root directory: Navigate to the root directory of your WordPress installation. This is usually in a folder named public_html or www.
3. Add the .maintenance file: Right-click in the root directory and select Create new file. Name this file .maintenance. Using FileZilla’s local text editor, add the following code to the .maintenance file:
<?PHP
$upgrading = time();
?>
4. Upload and save: Save the .maintenance file to the root directory on the server.
This method makes your site show a maintenance message to visitors while you work on your updates. A critical aspect of site maintenance for WordPress.But after you finish updating your site, remember to delete the .maintenance file to disable maintenance mode and make your site live again.
Note: Remember that WordPress hides all files that start with a ‘.’. To find this hidden file, click on Server and then Force showing hidden files. Once you find the .maintenance file, right-click and select Delete.
While this method is effective, it’s more technical and requires careful steps. That’s why using a plugin, as mentioned earlier, is often a better and simpler choice. It’s user-friendly and reduces the risk of making errors.
C) Adding code to functions.php
Another way to enable maintenance mode is by adding code directly to your theme’s functions.php file. Here’s how you can do it:
1. Navigate to the Theme Editor: Go to the Appearance tab in the sidebar, then click Theme Editor from the dropdown.
2. Edit the functions.php file: Find and open the functions.php file for the theme you are currently using. Insert the following code snippet to enable maintenance mode:
```php
// Activate WordPress Maintenance Mode
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');
```
3. Save the changes: Click on the Update File button to save changes. This code will show a maintenance message to visitors while allowing you, as the admin, to continue working on the site.
Once you’re done with the updates, you’ll need to remove this code snippet from the functions.php file and save the file again to disable maintenance mode.
D) Using .htaccess
Another way to enable maintenance mode is by using the .htaccess file to redirect visitors to a maintenance page. It’s a reliable method but it has to be handled with care. Any mistakes in the .htaccess file can make your entire website inaccessible, so always back up your site before making changes.
1. Create a simple HTML file: Use a text editor like Visual Studio Code and add the following code to the file:
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Yoursitename</title>
</head>
<body>
<h1>Sorry! This site is under maintenance!</h1>
</body>
</html>
You can customize the message you want for your visitors by replacing the existing message above within the file. You can dive into specifics about how long it would take to complete the maintenance process or just reassure them that it is temporary and planned.
Once the file is created, name it maintenance.html. This file will contain the message you want your visitors to see while your site is under maintenance. Upload the maintenance.html file to the root directory of your WordPress installation via FTP or cPanel.
2. Locate the .htaccess file: Again, since the file starts with a ‘.’ it will be hidden. You will have to unhide them. Via an FTP client like FileZilla, navigate to Server and then click on Force showing hidden files.
If you are using cPanel, click the Settings button in the top right corner and select the Check the Show Hidden Files (dotfiles) checkbox.
You will find this file in the root of your WordPress site’s directory. Add the following code to the top of the .htaccess file, replacing example.com with your site’s URL:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.)$ https://example.com/maintenance.html [R=307,L]
This code tells the server to redirect all new traffic to your maintenance.html file. Note that this does not redirect the visitors who are already viewing your site. The [R=307] flag signals that this is a temporary condition, which helps inform browsers and search engines.
After adding the code, test the maintenance mode by opening a new incognito browser window and visiting your site. You should see the maintenance message. When you’re done updating your site, remove the code from the .htaccess file to disable maintenance mode.
You can keep the maintenance.html file for future use or delete it as needed.
Troubleshooting common problems when using maintenance mode
Things can go wrong with even the best laid-out plans sometimes. You might find your site stuck in maintenance mode, displaying the wrong maintenance page, or even locking you out of your admin area. Don’t worry, though—we’ve got solutions for these common issues.
Stuck in maintenance mode
If you find that your site is permanently stuck in maintenance mode and you can’t turn it off, the problem is likely with the .maintenance file in your root directory.
Fix
Fix being stuck in the maintenance mode by using an FTP client or your hosting control panel to locate and delete this file.
The maintenance mode page is different from what you set up
Sometimes, the maintenance page that visitors see isn’t the one you customized using a plugin.
Fix
1. Clear your caches: Clear both your site cache and browser cache to see if this loads the updated maintenance page.
2. Verify settings: Ensure that your maintenance mode plugin settings or custom code are correctly applied and saved.
3. Refresh settings: Try deactivating and then reactivating your maintenance mode plugin to refresh the settings.
Unable to access the wp-admin page
If you can’t access your admin dashboard while your site is in maintenance mode, you might need to disable maintenance mode manually.
Fix
Remove the .maintenance file using FTP.
An alternative to WordPress maintenance mode: a staging site
A staging site is a copy of your website where you can safely test new themes, plugins, and other updates without anyone seeing the changes. You can use it to work on all your updates without taking your site offline.
BlogVault lets you create a staging environment with just one click. This means your live site stays up and running, keeping your visitors happy with zero downtime.
With BlogVault, your staging site is password protected, so search engines won’t crawl it and mess up your SEO. This way, you can identify and fix any bugs before making the changes live.
Using a staging site ensures that everything works perfectly before you push them to the live site. This makes it a smart and reliable alternative to traditional maintenance mode. This will also keep your site professional and fully operational while you work on it behind the scenes.
Upsides of using WordPress maintenance
- Prevents user confusion
- Improves user experience
- Maintains professionalism
- Easy activation
- Limits user access
Downsides of using WordPress maintenance
- Loss of traffic
- Manual steps required
- Potential downtime
- Lack of comprehensive testing
Best practices to use the WordPress maintenance mode
Using maintenance mode when updating your WordPress site helps prevent disruptions for your visitors. Here are some best practices to ensure everything goes smoothly:
Backup your website
Always start by backing up your website. We recommend that you use a robust backup plugin. This safeguard ensures you can restore your site if something goes wrong. A backup will save you a lot of headaches if any unforeseen issues arise during the update.
Schedule maintenance during off-peak hours
Plan your maintenance during times when your site has the least amount of traffic. This minimizes the impact on your visitors and reduces the chances of losing potential traffic and customers.
Inform your visitors in advance
Let your visitors know ahead of time that your site will be undergoing maintenance. You can do this through an announcement on your site, social media, or an email newsletter. Giving them a heads-up shows professionalism and keeps them informed.
Test before going live
Before taking your site out of maintenance mode, thoroughly test all the new features, themes, or plugins by using a staging site or a test site. This ensures everything works correctly and catches any potential issues before visitors see them.
Try to limit the duration of the maintenance
Aim to complete your maintenance tasks as quickly as possible. The shorter the downtime, the less inconvenience for your visitors. Plan and prepare everything you need beforehand to speed up the process.
Parting thoughts
Using WordPress’s maintenance mode will help avoid disrupting visitors and maintain professionalism during updates.
Some options you can use to put your site into maintenance mode include plugins, creating .maintenance files via FTP, adding code snippets to functions.php, and using .htaccess. We recommend using maintenance plugins as they are easy and ideal for all types of users.
For bigger updates, using a staging site allows you to conduct thorough testing without affecting your live site and reducing downtime.
FAQs
Does WordPress have a maintenance mode?
Yes, WordPress has a built-in maintenance mode. It activates automatically during core, theme, or plugin updates to prevent disruptions for visitors. For more control, you can also enable it manually.
How do I turn on maintenance mode?
You can turn on maintenance mode using plugins like LightStart, by adding a .maintenance file via FTP, by inserting a code snippet in the functions.php file, or by using your .htaccess file. These methods help ensure a smooth update process.
Why use maintenance mode?
Maintenance mode prevents visitors from seeing broken pages, maintains professionalism, and allows you to make updates without disrupting the user experience. It also helps safeguard your site’s reputation.
How safe is maintenance mode?
Maintenance mode is generally safe, keeping your site secure during updates by limiting access and preventing visitors from encountering incomplete features. It minimizes the risk of exposing vulnerabilities. Note that if your updates are interrupted, your website can get stuck in maintenance mode, potentially locking you out of your wp-admin panel.
Tags:
Share it:
You may also like
Complete Guide To WordPress Management
Managing WordPress sites means updating everything, finding tools to backup data, optimizing performance, and maintaining security. However, handling these tasks manually can become overwhelming. This is where management tools come…
10 Top WordPress Management Services
A WordPress management service is like hiring expert plumbers to fix your pipes, instead of DIYing it. Managing your WordPress site can be a daunting task. You must perform regular…
Top 5 WordPress Activity Logs to Boost Your Site’s Security
Maintaining a WordPress site can feel overwhelming with multiple changes happening all the time. Without a system to track these changes, it is hard to identify unauthorized modifications. If important…
How do you update and backup your website?
Creating Backup and Updating website can be time consuming and error-prone. BlogVault will save you hours everyday while providing you complete peace of mind.
Updating Everything Manually?
But it’s too time consuming, complicated and stops you from achieving your full potential. You don’t want to put your business at risk with inefficient management.
Backup Your WordPress Site
Install the plugin on your website, let it sync and you’re done. Get automated, scheduled backups for your critical site data, and make sure your website never experiences downtime again.