Table of Contents
Once your site goes live, there’s no time to sit back and sip a celebratory drink. Many tasks are begging to be on your ever-increasing to-do list. You’ll often use WordPress maintenance mode to keep this list manageable.
In short, your WordPress site can’t serve visitors while you’re working on it. As such, a dedicated state for the site 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 discuss why a staging site might be better 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 you’re working on your site and encourages them to return later. It’s activated when you perform theme, plugin, and core updates and toggled when you work on any back-end aspect of your site.
We’ll discuss how to avoid this downtime later. In the meantime, 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.
- 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 increase your bounce rate, affecting your other metrics.
While 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 the maintenance mode is active when performing updates. If you’ve studied site analytics in any capacity, you’ll know keeping users on your site is critical.
As such, you’ll want to reduce the number of times WordPress toggles maintenance mode. This will prevent access to your site from being affected.
A staging site is going to be your best friend here. 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 you commit to your changes, you click a few buttons and upload your staging site. This keeps downtime small and traffic levels high.
Having a staging site for development is a good investment. Also, you can ensure 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 for every site owner. As such, let’s show you how to better enter WordPress maintenance mode.
1. Use Code Within Your functions.php File
The direct method to toggle maintenance mode is to use code. In your functions.php file, 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 and updates.
- You’ll want to have a working knowledge of your WordPress core files.
- A clean backup should be in place in case the worst happens.
- You may want to use a Secure File Transfer Protocol (SFTP) client to access your site. However, this is optional, given WordPress now has a dedicated Theme Editor.
- You’ll want Administrator access to your WordPress back end and/or server. Whichever one is suitable depends on how you access the functions.php file.
In this example, we’ll be using WordPress Theme Editor. However, the process is almost the same when using SFTP.
Once you have these things in place, head to Appearance > Theme Editor within WordPress:
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 in maintenance mode.
From here, you can begin working on your site. When you’re ready to open it, remove the code and save your changes again.
Note that you can also revise the message displayed within the wp_die function. Everything between the single quotes within the parentheses gets rendered as text. As such, you could tell users when your site will be back online or anything else relevant.
2. Install a Dedicated WordPress Plugin
WordPress has a wealth of plugins to help you create a maintenance mode page as an alternative to coding. 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 creating a maintenance page that works for you. You can adjust the color scheme and design and add lead capture functionality. This lets you display a helpful 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:
The maintenance page is on by default, although you can toggle it using the large button at the top of the screen.
You can make many changes here, such as a custom page title or footer text. You can also change background images and branding elements and add Google Analytics tracking:
There are usually themes to choose from to style your pages in a snap:
A plugin is a solid option if you need a quick, visible maintenance page while you make updates. You could also use a plugin as a semi-permanent solution while creating your site. However, 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 also control when it’s active. 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 change your site, and will you use maintenance mode in the future? Let us know in the comments section below!