Need a quick way to enter maintenance mode in WordPress? Use the following snippet. Simply comment it out when you want to disable maintenance mode…
function maintenace_mode() {
if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
die('Maintenance.');
}
}
add_action('get_header', 'maintenace_mode');