How to Turn on Maintenance Mode in WordPress

Awhile ago we posted an article demonstrating how to put your WordPress site in maintenance mode by editing your .htaccess file. This may be an even easier way to turn on maintenance mode, since you don’t have to use FTP. Simply add this bit to your theme’s functions.php file:

{code type=php}
function maintenace_mode() {
if ( !current_user_can( ‘edit_themes’ ) || !is_user_logged_in() ) {
add_action(‘get_header’, ‘maintenace_mode’);

This snippet comes to you courtesy of, a great new source for helpful WordPress hacks. When you add this snippet it will shut down your site for anyone who is not the admin. When you want the site to return to normal, simply remove the function and you’re back in business.