Sometimes you might need to put wordpress into maintenance mode – this replaces your site with a basic message saying that the site is temporarily unavailable.

Why might you want to do this?

  • To correct a mistake in a template (so put it in maintenance while you restore from your ever handy backup).
  • While doing manual updating (for instance the automatic updating failed or a plugin is not available for automatic updating).

In order to do this simply put a file in the root of your wordpress install and name it .maintenance .  The file MUST be preceded by the “.” similar to a .htaccess file.

Normally this file has code in it to indicate how long the site will be under maintenance, and if the timestamp passes then the file is de-activated and the site is available – for instance to make the site be unavailable until now (Feb 17th 22:28 2011) do the following:

<?php $upgrading = 1297981662; ?>

However if you want the site to stay in maintenance mode as long as needed then the timestamp just needs to be kept changing so the following will do the job:

<?php $upgrading = time(); ?>

And that’s it – simple as that you can put wordpress into maintenance mode without a lot of hassle.