Last Updated on July 3 2022 by dhimaskirana
Sometimes you need to put your website into maintenance mode and let your visitors and readers know what is going on on your website. There are many plugins to turn your WordPress site into maintenance mode. But in this tutorial, I will share with you how to enable your WordPress site into maintenance mode without a plugin. We will use the default function from WordPress core.
We will use wp_die() function from WordPress code. By default wp_die() will kills WordPress execution and displays HTML page with an error message. So we will disable the site from visitors and give messages to visitors.
Copy this code below to your theme’s functions. And save it.
The maintenance mode will work for your visitor. If you log in to your site, the maintenance mode will be disabled.