X

Maintenance mode

Creates a maintenance mode where the WordPress blog is shut down for everyone but you.

If you are making some live changes(like updating source code and design) on your blog, you might want to enter a maintenance mode to keep the users from disturbing you.

What you can do is to use some conditional tags to shut down the website for everybody without admin permissions. You as a admin will still have full access to both the blog and to the admin panel.

Add this code to your functions.php.

Code Snippet:

<?php
function maintenace_mode() {
  if ( !current_user_can( 'administrator' ) ) {
    wp_die('Maintenance.');
  }
}
add_action('get_header', 'maintenace_mode');
?>

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!