Created
November 14, 2019 08:34
-
-
Save developer-anuragsingh/4c4e9d57699e9bab83a03a13da265f2c to your computer and use it in GitHub Desktop.
Add a "under maintenance" message, if user is not logged in as admin
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
function wp_maintenance_mode() | |
{ | |
if (!current_user_can('edit_themes') || !is_user_logged_in()) { | |
wp_die('<h1>Under Maintenance</h1><br />Website under planned maintenance. Please check back later.'); | |
} | |
} | |
add_action('get_header', 'wp_maintenance_mode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment