Add the following to current theme’s functions.php
before the closing PHP tag:
/*
Place the code below at the end of the theme's 'functions.php' file
*/
// Activate WordPress Maintenance Mode
function wp_maintenance_mode() {
if (!current_user_can('edit_themes') || !is_user_logged_in()) {
wp_die('<h1>Website Under Construction</h1><br/>Please check back later.');
}
}
add_action('get_header', 'wp_maintenance_mode');