How To Take WordPress Out Of Maintenance Mode

When updating WordPress or its plugins WordPress goes into maintenance mode. You might have often seen the message “Briefly unavailable for scheduled maintenance. Check back in a minute.” But what happens when something goes wrong and the maintenance mode sticks? Usually, WordPress deleted the file automatically, but unfortunately, bugs and connection errors happen. So how do you fix this problem and get your site back up? Here’s how to take your WordPress out of maintenance mode.

Removing the .maintenance.php file

The most simple and quickest way to take your WordPress out of the maintenance mode is to simply head on to your hosting provider cPanel open your public_html folder and remove the .maintenance file.

After removing the file your WordPress site should be accessible again and everything should work as normal.

Note – If you don’t see your .maintenance file you need to click on “Settings” and in the “Preferences” window select “Show Hidden Files (dotfiles)” and “Save“. The .maintenance should then be viewable and you can remove it to take your WordPress out of maintenance mode.

How to put WordPress in maintenance mode

There are a few different ways to put WordPress in maintenance mode and we will show you a few of the easiest ones.

1. Using functions.php

If you are looking for an easy way to place your site in maintenance mode you can do it easily through your themes functions.php file and a piece of code. Simply copy and paste the following code on the bottom of your functions.php file and your site will go into maintenance mode.

/*
* Activate WordPress Maintenance Mode
* https://bloginbox.com
*/

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’);

If you wish to change the message simply edit the “Under maintenance…” part to your liking.

Note – You should preferably add this to your child themes functions.php or it will be removed when you update your theme.

2. Using a plugin

If you are too afraid to touch your theme’s code there are always plugins you can use like “Maintenance“.

Simply install and activate the plugin and you can then turn the maintenance mode on and off. In the Maintenace plugin, you can turn the maintenance ON or OFF by clicking the switch and pressing “Save changes“.

Maintenance mode on/off

Did you like this guide? Comment below and tell us what you would like to learn next.

Similar Posts

Leave a Reply

Your email address will not be published.