If your WordPress site is stuck in maintenance mode, there’s a simple fix.
When you do certain admin tasks on a WordPress site, the site will appear (to anyone who visits) as undergoing maintenance. That means it’s not visible to the public. It’s a great feature when you’re actually doing admin or maintenance work. But every so often something goes awry, and WordPress gets stuck in maintenance mode. That’s not good … especially when your company depends upon that site to drive customers and clients for business.
I’ve had this happen to me on occasion, when a plugin update has gone afoul. If the plugin doesn’t upgrade properly, it could cause the WordPress site to get stuck in maintenance mode. When that happens, you might not even be able to gain access to the wp-admin section of the site. Should that be the case, what can you do? You can’t reach the web-based admin tools to fix the issue. You’re simply stuck.
Or are you?
SEE: Windows 10 security: A guide for business leaders (TechRepublic Premium)
Actually, there’s a very easy fix for this issue. The only thing you will need to get around the issue is shell access and a user account with sudo privileges.
When you find your WordPress site caught in the site maintenance loop, log into the hosting server and change into the root directory housing the WordPress folder. This is the same directory that houses the wp-admin folder and the wp-config.php file.
If your site is in maintenance mode, you should see a hidden file named .maintenance (Figure A). You can see that file if you issue the command:
In order to delete that file, issue the command:
sudo rm .maintenance
That’s it. If you now refresh your browser page, the site should appear again — no more maintenance banner to contend with. Your clients and customers can now access your WordPress site as if nothing happened.
A word of caution
One thing to remember is to always allow WordPress to complete any and all updates. There might be times when you click to update a selection of plugins, only to find that WordPress seems stuck. If you click the back button on your browser, you’ll interrupt those updates, causing WordPress to get stuck in maintenance mode. This will leave those plugin updates incomplete, which could expose your site to security issues. You always want to make sure WordPress (as well as any installed plugins) is up to date. So make sure when you do run the update, allow it to finish.
However, should something go wrong, and your site winds up stuck in maintenance mode, you now know how to fix the issue.