Phil Wylie

WordPress developer, Code Club volunteer & Staffs Web Meetup organiser

Enable WordPress maintenance mode

WordPress maintenance mode is a feature built into WordPress, enabled automatically when installing core/plugin updates. When maintenance mode is active, WordPress returns a 503 HTTP response and displays a “Briefly unavailable for scheduled maintenance. Check back in a minute” message.

Maintenance mode can be useful for developers too. Allowing you to hide your site from the public while you are doing maintenance. For example, when migrating WordPress between servers—it prevents data from getting out of sync.

There are a couple of methods to enable maintenance mode in WordPress. You can install a plugin to do it, but if you just need something fast there’s an easy plugin-free way too.

Enable WordPress maintenance mode with a plugin

The main advantage of the plugin route is that it allows you to set a message when maintenance mode is enabled. It’s more approachable for site owners with no need for FTP access.

If you want to go the plugin route, there are a few options. A popular choice is WP Maintenance Mode & Coming Soon. This plugin is free and has over 900,000 active installs.

The plugin allows you to create an attractive landing page for your visitors including a countdown timer to let them know when the site will be back up.

Administrators have full site access while the system is in maintenance mode, making it a good option for checking things over before turning the feature off.

Update – 06/03/2023

WP Maintenance Mode & Coming Soon has undergone a rebranding and now seems to require much more design configuration and has a greater focus on being an all-round landing page builder. While this might be great if your focus is on creating a coming soon page, it’s no longer a quick solution for displaying a simple briefly unavailable message.

After some testing, I’ve found a new plugin that I can recommend for enabling maintenance mode—Maintenance Mode by helderk. This plugin seems to be well-maintained and solves the problem at hand without any unnecessary complexities. It’s a great solution for quickly displaying a maintenance message for visitors while logged-in administrators can continue to check things over before disabling.

Enable WordPress maintenance mode without a plugin

If you need to do this only once or occasionally, then it may be best not to use a plugin. Plugins add to your attack surface and can be a point of failure if the plugin is not updated or maintained properly. Avoiding another plugin reduces your overall maintenance overhead.

A handy snippet to quickly activate maintenance mode

Create a temporary file called .maintenance in your root directory (i.e., public_html). In this file add the following code:

Once your maintenance is complete, delete the file.

Take it further by customising the maintenance page

Create a file called maintenance.php in your wp-content directory. When maintenance mode is activate, this file will be loaded allowing you to display a customised/branded message.

Conclusion

Maintenance mode is a handy feature that can help you keep your visitors informed while you’re working on it—and with multiple options available for enabling maintenance mode, I encourage you to use whichever approach works best for you and your site.

Improving WordPress search with Algolia

Helping customers to find things quickly reduces frustration and can lead to higher sales. The search functionality provided out-of-the-box by WordPress is at best considered basic. With customer expectations set by the likes of Google and Amazon, how can we improve the often overlooked on-site search experience?

Newer Posts
Older Posts