Maintenance mode without plug-in

Adding this snippet to the functions.php of your wordpress theme will put your wordpress website into Maintenance mode. To disable this snippet and allow people to access your website again, just comment out the last line // add_action(); .

 

 

function maintenace_mode() {
if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {wp_die('Maintenance.');}
}
add_action('get_header', 'maintenace_mode');

Be Sociable, Share!

Leave a comment