Once your site goes live, there’s no time to sit back and sip a celebratory drink. There are many tasks begging to be on your ever-increasing ‘to-do’ list. To keep this list manageable, WordPress’ ‘maintenance mode’ is something you’ll use often.
In short, your WordPress site can’t serve visitors while you’re working on it. As such, there’s a dedicated state for the site that restricts access until you’re done. The ‘baked-in’ solution is lean, but you can supplement the functionality with plugins.
Given this, we’ll discuss what WordPress maintenance mode is, and why you’d want to use it. Before we show you how to toggle the state, we’ll also chat about why a staging site might be a better fit for you.
What WordPress Maintenance Mode Is
Of course, maintaining your WordPress site is a crucial task that you need to carry out daily. Much like a well-oiled machine, your site is prone to digital rust in the form of bugs if you neglect it. What’s more, you may introduce vulnerabilities that invite malicious intent.
One tool built into WordPress to help keep your site in top condition is the maintenance mode. In a nutshell, WordPress can’t show the front end of your site if you’re tweaking the back end. In these cases your site will display a message in place of your usual home page:
It tells visitors that you’re currently working on your site, so to come back later. It’s something that gets activated when you perform theme, plugin, and core updates. It’s also toggled when you work on any back end aspect of your site.
We’ll talk later about how you can cut out this downtime. Regardless, next we’ll show you why maintenance mode is essential for your site.
Why You’d Want to Use WordPress Maintenance Mode
It’s a misnomer to say that you choose to use WordPress maintenance mode. You have to use it whether you want to or not. In other words, it’s inherent to the platform.
Instead, here’s why you’d want to use something other than the default maintenance mode:
- The default display message isn’t descriptive and clear enough for your visitors.
- The page isn’t branded, and doesn’t subscribe to your visual design scheme.
- There’s nothing on the page to help keep visitors around while you carry out work.
In short, the default maintenance mode message is more likely to hammer your bounce rate. This is going to have a knock-on effect to your other metrics.
While we’re here, let’s introduce a potential alternative to using maintenance mode.
The Benefits of a Staging Environment For Your WordPress Website
Earlier, we noted that maintenance mode is active when performing updates. If you’ve studied site analytics in any capacity, you’ll know that keeping users on your site is key.
As such, you’ll want to reduce the number of times WordPress toggles maintenance mode. As a result, it won’t affect the access to your site.
A staging site is going to be your best friend here. You can consider it an exact copy of your site, ready for you to work on. Meanwhile, your visitors can still access your live site without downtime.
When it comes time to commit your changes, you click a few buttons and your staging site gets uploaded. This keeps downtime small, and your traffic levels high.
Having a staging site for development is a good investment. Also, you can make sure changes won’t affect your site’s functionality before you push it live.
How to Enter WordPress Maintenance Mode (2 Methods)
We appreciate that a staging site isn’t going to be for every site owner. As such, let’s show you how to enter WordPress maintenance mode in a better way.
1. Use Code Within Your functions.php File
The direct method to toggle maintenance mode is to use code. Your functions.php file is where you’ll add a couple of snippets to activate it, and remove them when you’re done.
Before you begin, you’ll need the following in place:
- Your site should run on a child theme, as this will preserve your changes making updates.
- You’ll want to have a working knowledge of your WordPress core files.
- There should be a current, clean backup in place – in case the worst happens.
- You may want to use a Secure File Transfer Protocol (SFTP) client to access your site. It’s optional though, given that WordPress now has a dedicated Theme Editor.
- You’ll want to have Administrator access to your WordPress back end and/or your server. Whichever one is suitable depends on how you’ll access the functions.php file.
We’ll be using WordPress’ Theme Editor in this example. Regardless, the process is almost the same when using SFTP.
Once you have these things in place, head to Appearance > Theme Editor within WordPress:
From here, choose your child theme from the top right-hand drop-down menu, and look to the sidebar. This will show a list of your site’s files:
Next, look for Theme Functions (functions.php) and click to load it into the editor. Scroll to the bottom of this file, and enter the following code snippet:
// 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’);
Once you save your changes, head to your site’s front end and check that it’s now in maintenance mode.
From here, you can begin to work on your site. When you’re ready to open up your site, remove the code and save your changes again.
Note that you can also revise the message that’s displayed within the wp_die function. Everything between the single quotes within the parentheses gets rendered as text. As such, you could let users know when your site will be back online, or anything else that’s relevant.
2. Install a Dedicated WordPress Plugin
As an alternative to coding, WordPress has a wealth of plugins to help you create a maintenance mode page. In fact, there are so many to choose from that it’s hard to narrow them down. Even so, Coming Soon Page, Maintenance Mode & Landing Pages by SeedProd is a solid solution. There is also Maintenance, WP Maintenance Mode, and lots more.
The advantage of using a plugin is that you can create a maintenance page that works for you. You’re able to adjust the color scheme and design, and add in lead capture functionality too. This lets you display a useful page that visitors will interact with rather than leave.
Installing and activating your chosen plugin is like any other. Once you’ve done this, you’ll usually see a dedicated admin panel within WordPress. Here, we’re using the Maintenance plugin:
By default, the maintenance page is on, although you can toggle it using the large button at the top of the screen.
Here, you’re able to make lots of changes, such as a custom page title or footer text. You can also change background images, branding elements, and add Google Analytics tracking:
In fact, there are usually themes to choose from, to style your pages in a snap:
If you need a quick visible maintenance page while you make updates, a plugin is a solid option. Even so, you could also use a plugin as a semi-permanent solution while creating your site. Though, we recommend using a local development environment and staging for long-term projects.
In Summary
Keeping your site in tip-top shape means carrying out regular maintenance. WordPress can serve pages to users while you’re working on it though. To help with this, WordPress has a dedicated maintenance mode.
It’s provided as an automatic state, but you can control when it’s active too. Here are two ways to do so:
- Add code to your functions.php file.
- Install a plugin such as Maintenance to create an advanced maintenance mode page.
How do you make changes to your site, and is maintenance mode something you’ll use in future? Let us know in the comments section below!