WordPress Maintenance Mode Without a Plugin
Every so often someone asks a question in the Wordpress IRC channel that sparks my interest, and in this case the core maintenance mode functionality was one of those questions. I’ve known for sometime that WordPress has it’s own maintenance mode functionality since core upgrades were added, however I had never really looked into the functionality. Hooking into this functionality is really quite simple and effective.
Start by creating a file in the root of your WordPress install (on level with wp-settings.php) called .maintenance. Note the preceding dot like a .htaccess file; in Linux this is considered a hidden file. In this file add the following code:
<?php $upgrading = time(); ?>
This code will basically cause the maintenance page to display until you remove the .maintenance file. In wp-settings.php there are 2 checks to see if it should display the maintenance page. First, it makes sure that the .maintenance file exists. Second, it checks that the current time minus the time specified by the $upgrading variable is less than 10 minutes. Using the code above will insure that it is always less than 10 minutes since time() - time() == 0. If you want it to display for a certain period of time you would want to use:
<?php $upgrading = 1234567890; ?>
For your usage you would want to replace 1234567890 with the unix formatted timestamp of the time minus 10 minutes at which you want the maintenance page to stop displaying.
For example if I wanted the maintenance page to stop displaying at November 14, 2013 at 20:13:00, I would really set the $upgrading variable to November 14, 2013 at 20:03:00. Notice the 03 instead of 13. In unix time this would look like 1384459380. And the code needed for the .maintenance file would be:
<?php $upgrading = 1384459380; ?>
Take note that if you use a specific time in the .maintenance file and you do not remove the .maintenance file, your users will see your site and not be affected, however in the admin you will see a notice stating, “An automated WordPress update has failed to complete – please attempt the update again now.” Deleting the .maintenance file will remove this notice.
I’m sure that this functionality could be wrapped in a plugin, or even better an option added to the core code in the admin. However, I am happy with just manually creating the file.
For information on modifying or styling the maintenance page see WordPress Maintenance Mode Without a Plugin Part 2.

Cool tip, didn’t know about this feature. Thanks :)
Is there a way to style it? Or is this just a core feature being used?
Say I want it to have a black background with my logo in the middle with some text below it saying the message already shown.
It would be great if the look and the language “check back in a minute” could be customized.
Note wp-admin area is not accessible also.
When I do this, nothing happens…odd.
Maybe if I spelled it right. :-) Thanks for the tip.
Thanks a lot.
thanks for the tip..
And I just found this link, to convert time to unix time
http://www.onlineconversion.com/unix_time.htm
Thanks for sharing this wonderful plugin. This would be useful to all my blogs.
A little known WordPress gem – thanks for sharing and the well written article!
I literally just discovered this while working my way line by line through the Wordpress initialization process (from wp-load to wp-config to wp-settings) trying to debug and fix another problem I was having. That’s what I like to call snazzy!
Your link to customizing the page is missing, but it would seem that all you have to do from looking at the code is create a maintenance.php file in your wp-content/ directory.
Snazzy.
thanks for the tips brother,
tips brother thanks for u
Also, in case anyone is getting “you must type a file name.” error when trying to create the file-
Create a txt file and open it in Notepad.exe. Then do a file | Save as.. select ‘all files’ and then name it (.maintenance)
I noticed that also wp-admin area is not accessible. So I cannot desactivate pluggins, for instance. Any idea to get access as an administrator?
Perhaps reading some more articles on this site would help, perhaps: http://sivel.net/2009/10/wordpress-maintenance-mode-without-a-plugin-part-3/
with no wp-admin acess this is completly useless
Your reading skills are completely useless: http://sivel.net/2009/10/wordpress-maintenance-mode-without-a-plugin-part-3/