Back to Top

How To Put WordPress Site Into Maintenance Mode?

WordPress site into maintenance mode Without Plugin

With explained hook function over here, you can put WordPress site into Maintenance Mode easily.This is useful if you want to test a design change or new functionality without affecting your readers. So they will know that they are carrying out maintenance tasks.

By placing the following function in functions.PHP, you can see each user who is not logged in or do not have permission to edit the theme rather than enter the site, an error message will be displayed on the site that we want.

function cd_maintenancemode() {
	if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
		wp_die('Site is in maintenance Mode.!!');
add_action('get_header', 'cd_maintenancemode');

That’s it, Now you can see your site is in maintenance mode.

Thank you for reading, good luck and let me know if you run into any problems & I’ll help as much as I can 🙂
Hope this post will helpful for you, waiting for your responses.Thanks for reading and feel free to share your thoughts! Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

What is Parent:: and Self:: in PHP

Posted on 7 years ago


Warning: Ignoring WordPress Can Be a Blunder

Posted on 6 years ago

Nick Carter

The Reader’s Poll – June 2015

Posted on 3 years ago


The Reader’s Poll – August 2014

Posted on 4 years ago


The Reader’s Poll – June 2014

Posted on 5 years ago


The Readers’ Poll – May 2014

Posted on 5 years ago


The Readers’ Poll – August 2013

Posted on 5 years ago