Created
July 3, 2022 13:21
-
-
Save dhimaskirana/44a483e20fca3b9b7b2e52043542f1f8 to your computer and use it in GitHub Desktop.
How to Enable WordPress Maintenance Mode Without a Plugin
This file contains 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 | |
// Activate WordPress Maintenance Mode | |
add_action('get_header', function () { | |
if (!current_user_can('edit_themes') || !is_user_logged_in()) { | |
wp_die('<h1>Website Under Maintenance</h1><br />We have got some exciting updates lined up for you. We will be back online! Thank you. 🙏', 'Website Under Maintenance'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment