Last active
December 19, 2018 10:44
-
-
Save damiencarbery/388652a791bfac7bbbdaf414ebdf4383 to your computer and use it in GitHub Desktop.
Simple Maintenance Mode - https://www.damiencarbery.com/2018/06/simple-maintenance-mode/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Maintenance Mode (Simple) | |
Plugin URI: http://www.damiencarbery.com | |
Description: Put site into maintenance mode for regular site visitors. Deactivate plugin to disable maintenance mode. | |
Author: Damien Carbery | |
Version: 0.3 | |
*/ | |
// Wait until 'wp' to allow login page to work. | |
add_action( 'wp', 'maintenance_mode' ); | |
function maintenance_mode() { | |
if ( !is_user_logged_in() || !current_user_can( 'switch_themes' ) ) { | |
wp_die( get_bloginfo( 'Name' ) . ' is undergoing maintenance.' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment