
Learn how to inform users that your WordPress site is in maintenance mode by using this clean, simple code snippet from WPCodeBox.

Every website goes through downtime during updates or major design changes. Leaving your site visible while the layout is broken looks unprofessional and confuses your visitors.
You need a reliable way to hide your work-in-progress while maintaining your own access to the backend.
In this article, I’ll show you how to enable maintenance mode using a simple code snippet. I’ll also show you how to use a page builder if you prefer a visual, no-code approach for your maintenance page.
Maintenance mode protects your brand by replacing a broken layout or PHP errors with a clean, branded message.

It also protects your search rankings by adding a 503 Service Unavailable status code. This tells search engines that your site is only temporarily down for updates, rather than being permanently removed. This saves you from the risk of Google de-indexing your pages, which often happens when a crawler encounters a broken site or a 404 error.
Maintenance mode also provides a layer of security during major updates or migrations. Broken websites can sometimes expose sensitive site structures or temporary vulnerabilities to the public. Maintenance Mode ensures that only authorized administrators see the site while it is in a vulnerable state, which keeps your data and configuration private.
You can install a dedicated maintenance plugin to lock down your site, but most of these plugins add unnecessary bloat to your dashboard for a temporary task. A lightweight code snippet is much more efficient because it handles the restriction without the performance overhead of a plugin.
This approach gives you a clean and reliable way to redirect guest visitors to a simple notification message while allowing you to view and test your site changes normally.
function wpcb_maintenance_mode() {
if ( !is_user_logged_in() ) {
wp_die(
'<h1>Site Under Maintenance</h1><p>We are currently performing scheduled updates. Please check back soon!</p>',
'Maintenance Mode',
array('response' => 503)
);
}
}
add_action('get_header', 'wpcb_maintenance_mode');This snippet uses the wp_die function to stop the page from loading for logged-out visitors. You’ll notice the 503 response in the code, which protects your search rankings by informing crawlers that your site will return soon. It is a clean, effective solution for keeping your work-in-progress hidden.
Adding this code to your theme’s functions.php file is a common approach, but manual file editing often leads to serious technical issues. Your custom code can disappear every time you update your theme, which forces you to re-add your snippets manually. A single misplaced character can also trigger a critical error that takes your entire website offline.
A snippet plugin eliminates these risks by running your code independently from your theme. WPCodeBox is the best plugin for this use case as it allows you to manage all your PHP, CSS, SCSS, and JavaScript snippets from one organized dashboard.

The plugin creates a secure execution environment with intelligent error detection that prevents most mistakes from breaking your site. This ensures your maintenance mode settings stay active even when you switch themes or run updates, making your customizations truly portable and maintenance-free.
Now that you know why WPCodeBox is the most reliable way to manage your code, let’s look at the steps to add the maintenance mode snippet to your site:

Your maintenance message is now active for all guest visitors while you continue working on the backend. This setup also ensures that search engine crawlers understand your downtime is only temporary, letting you work on your website updates.
What if you want to enable maintenance mode without adding any code to your website? If that’s the case, you can use the built-in maintenance mode feature in Breakdance to create a custom-designed landing page in minutes. This no-code approach is perfect if you want to build a high-quality Maintenance page that matches your brand perfectly.

To create the maintenance mode page using Breakdance, navigate to Breakdance > Settings in your WordPress dashboard and click on the Maintenance Mode tab. You can enable the feature by choosing between 200 Coming Soon for new projects or 503 Maintenance for existing websites. When you select the 503 option, it ensures your SEO stays protected by telling search engines that your site is only temporarily unavailable.

You’ll need to select a specific page to display as your maintenance message. If you haven’t designed one yet, you can quickly create a new page, design it with the Breakdance editor, and then return to these settings to select it. Breakdance allows you to add custom contact forms, social links, or countdown timers to keep your audience engaged while you work.

You also have granular control over who can view your site during the downtime. You can configure the access settings so that only users with the Administrator role can bypass the maintenance screen.
Once your updates are finished, you can simply return to the settings and set the mode back to Disabled. This immediately makes your site accessible to the public and search engines again.
If you prefer to watch the setup process in action, you can follow along with this YouTube video.
You can verify your maintenance mode is active by visiting yoursite.com in a new private or incognito browser window where you are not logged in.
If you see your custom maintenance message or the Breakdance landing page, the restriction is working correctly. You should also verify that your administrative access still works by navigating your site in your main browser window.

If you see your custom maintenance message or the Breakdance landing page, the restriction is working correctly. You should also verify that your administrative access still works by navigating your site in your main browser window.
How do I turn on maintenance mode in WordPress Elementor?
How do I turn off maintenance mode in WordPress?
You can turn off maintenance mode by reversing the method you used to enable it. If you used a code snippet in WPCodeBox, simply toggle the snippet to “Disabled” or delete the PHP filter from your site. If you used a builder like Breakdance or Elementor, navigate back to the maintenance settings in the plugin dashboard and set the status to Disabled before saving your changes.
How to add a coming soon page in WordPress without a plugin?
You can add a coming soon page without a plugin by using a PHP code snippet to redirect guest visitors to a temporary message. This method uses the wp_die function to display your text and a proper status code while still allowing administrators to access the site. Here’s the code snippet to add:
add_action('get_header', function() {
if ( !is_user_logged_in() ) {
wp_die(
'<h1>Coming Soon</h1><p>Our new website is almost ready. Stay tuned for our official launch!</p>',
'Coming Soon',
array('response' => 200)
);
}
});





