Working on a website means that you constantly have to take care of it. Writing new articles, adding new images and publishing videos might be a routine for a blogger, but you mustn’t neglect your website from the technical aspect. With WordPress, you will have to take care of updates. You will have to watch over your themes and plugins, and if there are any extra functions you have manually installed, you will have to make sure they’re up to date and always working properly.
If you are trying to change a theme or a layout of a live website, or if you’re doing any extra work on it which might render your WordPress site broken for a while, you should consider putting that site into under construction mode. A simple WordPress core or a plugin update may break your site for some reason, and while you’re working hard to bring everything back to normal, you shouldn’t let your visitors see that something’s wrong.
When changing things on a live site, it is smart to work on a local development installation or to use a staging site which is a must-have for serious users. Sometimes, that’s not possible, and you will have to put your site in the maintenance mode until the work is done. As you can see, there are many scenarios where you could benefit from the under construction mode, so it’s good to know how to use one. In this article, we’re about to show you how to customize an under construction page while your site is updating.
We already showed you how to quickly put your site into maintenance mode by adding an extra function to the functions.php file. You should know that, if you don’t want to use a plugin for the job, you can do a bit more than that to show that your site is going through changes.
Create the maintenance file
When updating core files or your themes and plugins, WordPress creates a temporary .maintenance file which is used for displaying a simple message. That message shows up to anyone who opens your site during the installation process. Unfortunately, the file gets deleted immediately after the installation is done, so you can’t use it for a longer period of time. Also, the file isn’t customizable. But don’t worry; if you want to create your own maintenance files and customize them into details, here’s what to do:
- Open wp-content folder
- Create a new file and name it maintenance.php
- Customize the page, style it with CSS and save changes
Since WordPress already included a check for this file in its wp-includes/load.php file, you’re done! Now when you start updating WordPress core files, plugins, and themes, WordPress will check if there’s maintenance.php file located in wp-content folder. If so, the file will be used to render a page for everyone who loads your site.
Customize the file
To help you get started with the customization of the file, we have created a very simple maintenance.php file for you:
- Edit maintenance.php you have just created
- Copy and paste this code:
- Save changes
This code creates a simple page that looks like this:
Still, if you want to make the most out of your maintenance mode, we suggest using a plugin. As you can see, coding your own page will take time and skill, and you still won’t get the most of it.
Under Construction allows you to lock your WordPress site just by a single click. You get to choose different images created by professionals, add your social media info the easy way, and you can even whitelist specific user roles who will be able to see the original site even when it’s under construction. We will write more about this great plugin in the following days so stay tuned for a detailed review or go ahead and download the plugin now – it’s free!
- Check for broken links in WordPress automatically
- Best online tools to quickly check for broken links on your WordPress site
- How to activate WordPress maintenance mode
- Write notes in posts which only admins can see
- Under Construction Page - let people enjoy your site even while you're doing maintenance