Maintenance Mode refers to a term for special state owners can put their WordPress website in. It’s self-explanatory to a degree, as it does exactly that—let you maintain your website. Consequently, the website stays online, preserving uptime, and remains accessible to admins, writers, designers, or editors. However, regular visitors or anyone you decide is forbidden access and get a message stating why. You can customize the message to your liking, though rarely does anyone suggest that, seeing how rarely it appears and for a short time. With all that said, let’s dive into how to activate Maintenance Mode in WordPress.
1. Enable Maintenance Mode via functions.php in WordPress
We’re starting with a method that may be uncomfortable for beginners, as it involves adding code. However, that code can be safely added in the form of a code snippet, and easily erased from the file if things turn sour. Perhaps most importantly, the code isn’t too long, hard to understand, or difficult to edit to add a custom message. With all that said, follow these steps to activate Maintenance Mode on your WordPress website without third-party tools:
- Access your WordPress website source via FTP. You can also go to Appearance → Theme Editor in your WordPress Admin and skip to step 3.
- Go to the wp-content folder before going to themes, then the folder with the name of your active (child) theme.
- Once inside, open the file titled functions.php. If you went through the WordPress Admin section, the file is under “Theme Functions”.
- Scroll to the very bottom, and paste this code:
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');
You can now click on Update File if you’re satisfied with the default message. Otherwise, you can edit this portion:
<h1>Under Maintenance</h1><br/>Website under planned maintenance. Please check back later.
Change the wording or tweak the heading: h1 for the largest, h2 for slightly smaller, and so forth.
Be warned, the notification is rudimentary and primarily designed to be short notice to your visitors. For a longer downtime, we suggest methods 1 and 2 and spending more time to make things appealing to the eye. It’s also a good idea to include a Call to Action (follow social media, sign up for a mailing list, contact us, and so on).
2. Add and Activate WordPress Maintenance Mode through a plugin
Scared to meddle with the files in the root folder of your WordPress website? Need a more detailed message, akin to a landing page, that will stay up for longer than minutes or an hour? Want to include features such as a subscription form, countdown, calendar, responsive buttons, and, perhaps, social media icons? Installing a dedicated WordPress plugin can help with all that. Though there are over a thousand plugins and we neither have a preference nor a favorite, the one below seems to stand out in the community, hence we’ll use it for demonstration.
After you finish the installation of the plugin and enable it, do the following:
- Expand the left sidebar of WordPress Admin.
- Click on Settings, then, when it expands to the right, select WP Maintenance Mode.
- You’ll now see plugin settings and 5 tabs: General, Design, Modules, Manage Bot, and GDPR (for European Union countries only) If you want the simplest notice that just works, click on Activated under “Status” on the General page. Select Save Settings.
- Visitors will now see a basic message on the home page until you switch the Status back to Deactivated and click the Save Settings button again.
Extra options within WP Maintenance plugin
As mentioned above, there are 4 more tabs to explore if you wish so. Here’s a quick rundown of the key additional options WP Maintenance has:
General tab
Besides Status, there are crucial settings in the General section:
- Bypass for Search Bots: Select Yes if you still want to permit search engine bots to circumvent the maintenance page and visit and index your website.
- Backend Role: Select a user role that will still have access to the WordPress Admin while Maintenance Mode is active.
- Frontend Role: Pick which user role can access the frontend of your website while Maintenance Mode is in full swing.
- Robots Meta Tag: You specify which meta tags (follow, index, nofollow, noindex) search engine bots will use, letting you make page-specific decisions.
- Redirection: Make users get temporarily redirected to a specific URL while the status is active.
- Exclude: Enter names of pages for which the Maintenance Mode shouldn’t apply, i.e., the plugin should eliminate from its settings.
- Notice: Pick Yes if you want to continue getting notices while the status is in effect.
- Dashboard link: Choose Yes if you want to see a link to WordPress Admin on the frontend page.
Design section
This tab is the reason many users opt for this plugin and a variety of others. It is responsible for the styling and appearance of the maintenance page. This particular plugin allows you to add a title, heading, starting with h1, and some content other than the default one. Moreover, in this specific case, you’ll see three options for an image background:
- Background color: Pick a solid color from the list or via hex code.
- Predefined background: Select one of the free backgrounds the plugin offers.
- Upload an image: Add your image and use it as the background.
Modules tab
The Modules section is pivotal if your Maintenance Mode is time-related, or if you wish to include some contact options. Here are 4 notable modules available:
- Countdown: Select Yes, then pick a date and time the maintenance should start and end. Alternatively, set a time in minutes for the countdown.
- Subscribe. Let your visitors subscribe and get a notification when the website is up again.
- Social Networks: Add links to a variety of your social media accounts that should appear on the front end.
- Google Analytics: Just because your regular content is inaccessible to visitors doesn’t mean you should stop tracking the regular analytics. You can add your tracking ID and turn on Google Analytics while the Maintenance Mode is enabled.
Note. Manage Bot is a pre-defined page that will show a chatbot instead of the Maintenance Mode you set up via “General”. GDRP page is designed to make your data collection practices compliant with General Data Protection Regulation.