Your own WordPress Maintenance mode page

wordpress maintenance mode

The thing that you should do if you have a WordPress website is update your installation.  Not only the WordPress files but, more importantly, any of the  plugins that you use as this will help protect your website from hackers and other malicious attacks from the Internet.

When you do update, your website will go into what is called Maintenance mode. This happens to protect itself in case you are trying to access, or write to, the database. This could cause untold damage as nobody makes a backup of their database as often as they should.

This post will show you that you can have your own, bespoke, maintenance mode page appear. This doesn’t use any plugins as other bloggers have recommended. I’m against that as what happens when the maintenance mode plugin needs updating?  It’s also better not trusting things like this when you can do it very simply if you have FTP access to your website.

Below is what normally happens when WordPress goes into this mode.  Boring isn’t it?  Doesn’t tell you a lot.  Is the website broken or will it come back?

MaintenanceMode2

This is where WordPress comes into its own. When the system goes into this strange mode, it first checks your wp-content directory for a file in there called maintenance.php. You can see mine if you head over here.

So the simplest thing to do is upload the above mentioned file into the right directory and you’re away.  Just make sure that if you use any PHP make sure it’s correct and doesn’t use any WordPress calls.

There are a couple of things that you have to remember if you write your own maintenance mode page:

  1. You can’t access any of the core WordPress, or plugin, calls. That means that blogname or the_post are out. Yoast won’t be able to write your Google Analytics code to the page etc.
  2. It’s better to use all your CSS as inline calls on the page as this page won’t know what theme you are using or where to find it.
  3. Keep all the links to images relative to the root of your website. If you do that, you won’t forget to alter this file if you change your domain name.

Just think of the maintenance.php file as a static html file with a different extension as you won’t have any access to any core WordPress call. Also, keep it simple, and informative of what’s going on. Reassure people that you will be back shortly. Let them know that this is totally normal. I always feel that it should be, slightly, light hearted so people will remember you and they should return when you are back up and running.