Created
April 4, 2018 15:02
-
-
Save amielucha/aad16d8783445d799529a84afb7a4c7c to your computer and use it in GitHub Desktop.
WordPress maintenance mode snippet
This file contains hidden or 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 | |
| /* | |
| * Temporarily block access to the WordPress site. | |
| */ | |
| function my_little_maintenace_mode() { | |
| if ( !current_user_can( 'administrator' ) ) wp_die('Please <a href="' . wp_login_url() . '">log in</a> first.'); | |
| } | |
| add_action('get_header', 'my_little_maintenace_mode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment