Code to Turn On Maintenance Mode for WordPress without Plugin

function wpflt_wp_maintenance_mode() {
    if (!current_user_can('edit_themes') || !is_user_logged_in()) {
        wp_die('<h1>Hello Folks</h1><br/>Just having a cup of tea');
    }
}
add_action('get_header', 'wpflt_wp_maintenance_mode');

Add this code to your child theme’s functions.php file. Customize the message text in line 3.