Help! How to take WordPress out of Maintenance Mode

I have been busy updating my site as my focus is changing and once I had completed all the changes I decided I would also upgrade my wordpress version. I usually leave it as long as possible because I have had some problems with it in the past. This time when I went to update it, it seemed to stall so I clicked another link – which was clearly a mistake because the page that loaded was just a message that it was in Maintenance Mode.
When I clicked on my site it now looked completely white with a “Briefly unavailable for scheduled maintenance. Check back in a minute.” message.
Which freaked me out a little bit, I’ll be honest. Fortunately I was able to find information that I can just remove a file on my server which will take it out of maintenance so I could get back on the site and make changes. (when WP is in maintenance mode you do not have acces to any of your normal screens through a browser, including your dashboard.
Thankfully the solution is easy:
- Log into your server space through ftp
- locate the .maintenance file in your root directory
- delete the file
And it should all be working again as normal. Information via onemansblog
How to put your site in Maintenance Mode
Now after solving this I decided to dig a little deeper and came across some interesting things that can be done with the .maintenance file. If you are in the process of having a site upgrade- as I was, and you don’t want people to see your site looking dodgy mid way through your changes, then you can use this file to your advantage.
When you implement this, it will show a maintenance page (which you can design to have anything you want) as well as let you access all your WordPress panels that we couldn’t access earlier. All you need to do is the following in two easy steps:
Step 1
- create a .maintenance file
- The following code will allow you to show a pre defined page that you have designed as well as let you access your admin panels as usual
function is_user_logged_in() {
$loggedin = false;
foreach ( (array) $_COOKIE as $cookie => $value ) {
if ( stristr($cookie, ‘wordpress_logged_in_’) )
$loggedin = true;
}
return $loggedin;
}
if ( ! stristr($_SERVER['REQUEST_URI'], ‘/wp-admin’) && ! stristr($_SERVER['REQUEST_URI'], ‘/wp-login.php’) && ! is_user_logged_in() )
$upgrading = time();
?>
- upload it via ftp to your WordPress directory (root) where all your wordpress files are saved
- create a maintenance.php file
- add the following code but alter it to display what you would like. In this example I have kept it the same as the default but added a link to my Twitter account.
$protocol = $_SERVER["SERVER_PROTOCOL"];
if ( ‘HTTP/1.1′ != $protocol && ‘HTTP/1.0′ != $protocol )
$protocol = ‘HTTP/1.0′;
header( “$protocol 503 Service Unavailable”, true, 503 );
header( ‘Content-Type: text/html; charset=utf-8′ );
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Maintenance</title>
</head>
<body>
<h1>Briefly unavailable for scheduled maintenance. Check back a little bit later.</h1>
<p>If you have anything urgent to ask me you can find me on Twitter as <a href=”http://twitter.com/cmoz”>CMoz</a>.
</body>
</html>
<?php die(); ?>
- upload the file to your wp-content folder
- do a little dance because it was pretty painless
No related posts.
0 Comments