Enable Maintenance Mode in WordPress

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');
Discussion
[  0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!