How to Use
Download > Install > Activate. That’s it!
Example
Once activated, website will be forced into WordPress “maintenance mode” until deactivated. Edit the text to fit your needs, will accept HTML tags. Be sure to purge all caches (browser & server) and be logged out to view.
Source
This code can be pasted into the functions.php file of your child theme or, download and install the plugin for simple code activation.
function viawebs_plugins_force_maintenance_mode() {
if (!current_user_can('edit_themes') || !is_user_logged_in()) {
wp_die('<h1>Website Unavailable</h1><br />Please check back later.');
}
}
add_action('get_header', 'viawebs_plugins_force_maintenance_mode');