Wordpress Maintenance Mode Without Plugin

Add Tool

Wordpress Maintenance Mode Without Plugin


Wordpress Maintenance Mode Without Plugin

Sometimes, you may need to put your blog or website maintenance mode on hold while performing some maintenance. There are many plugins to set your web site as maintenance mode. But you can do WordPress maintenance mode without plugin quickly by adding some php codes into your theme’s functions.php file.

Set WordPress maintenance mode

Just paste the following snippet into your functions.php file and save it. It will convert your site as maintenance mode. Now your blog is unavailable to anyone without administrators.

<?php
function cwc_maintenance_mode() {
    if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
        wp_die('Maintenance, please come back soon.');
    }
}
add_action('get_header', 'cwc_maintenance_mode');

?>

To check the activity of WordPress maintenance mode of the above WordPress snippet please logout. After logout browse your site. You will see a message “Maintenance, please come back soon.” You will only see the site as a logged in user. You can set your own maintenance message by following below instruction Find

wp_die('Maintenance, please come back soon.');

And replace it with

wp_die('here write your own maintenance message.');

Don’t forget to remove the code when you’re done with maintenance! See Also: Customize WordPress Login Page Without Plugin


Tags: wordpress maintenance mode, maintenance mode wordpress, wordpress website maintenance, wordpress maintenance service, wordpress maintenance
Payza

About Masum Billah

Wordpress Maintenance Mode Without Plugin Hi I am Md. Masum Billah Contributor of this website. I always like to share various things with other. In this website I am sharing web design related tips and tricks, necessary web development tools, source codes for beginner and advance web developer.


SIGN UP TO GET UPDATE TO YOUR INBOX




Discuss about: Wordpress Maintenance Mode Without Plugin


adf.ly