WordPress maintenance mode

There are few different ways how to put WordPress on maintenance without the plugin. I personally don't like to have many plugins installed on the WordPress website, because they are slowing down the website and outdated plugin can cost serious security issues.

But let's learn how to put WordPress on maintenance without a plugin. Before we start, make sure you did install WordPress Child Theme. It's good practice to use child theme as the main theme. After the theme update, your theme's footer widget will stay the same and you don't have to update it manually. Note: if you haven't installed a child theme, after theme update, you will lose all your files in the footer section. All you have to do is add this code in your child or main theme functions.php file:

// Activate WordPress Maintenance Mode
function wp_maintenance_mode(){
    if(!current_user_can('edit_themes') || !is_user_logged_in()){
        wp_die('

Website under Maintenance


We are performing scheduled maintenance. We will be back on-line shortly!'); } } add_action('get_header', 'wp_maintenance_mode');

That is all, now your website will be in maintenance mode, but if you will login as administrator, you will be able to see your website in live mode.

UPDATE: Since WordPress 5.2.0 version maintenance mode comes as a feature.


Back to Blog