{"id":1664,"date":"2025-12-21T20:07:44","date_gmt":"2025-12-21T19:07:44","guid":{"rendered":"https:\/\/wpcodebox.com\/?post_type=tutorial&#038;p=1664"},"modified":"2025-12-21T20:11:41","modified_gmt":"2025-12-21T19:11:41","slug":"enable-maintenance-mode-wordpress","status":"publish","type":"tutorial","link":"https:\/\/wpcodebox.com\/tutorial\/enable-maintenance-mode-wordpress\/","title":{"rendered":"How to Enable Maintenance Mode in WordPress"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You need a reliable way to hide your work-in-progress while maintaining your own access to the backend.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this article, I\u2019ll show you how to enable maintenance mode using a simple code snippet. I&#8217;ll also show you how to use a page builder if you prefer a visual, no-code approach for your maintenance page.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why You Should Use Maintenance Mode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Maintenance mode protects your brand by replacing a broken layout or PHP errors with a clean, branded message.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/critical-error-on-website-1024x617.png\" data-rel=\"lightbox-image-0\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"617\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/critical-error-on-website-1024x617.png\" alt=\"critical error on website\" class=\"wp-image-1666\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/critical-error-on-website-1024x617.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/critical-error-on-website-300x181.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/critical-error-on-website-768x463.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/critical-error-on-website.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Enable Maintenance Mode With a Code Snippet<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<div class=\"wp-block-wpcodebox-snippet wpcodebox-snippet\" data-language=\"php\"><pre class=\"line-numbers\"><code class=\"language-php\">function wpcb_maintenance_mode() {\n    if ( !is_user_logged_in() ) {\n        wp_die(\n            '&lt;h1>Site Under Maintenance&lt;\/h1>&lt;p>We are currently performing scheduled updates. Please check back soon!&lt;\/p>',\n            'Maintenance Mode',\n            array('response' => 503)\n        );\n    }\n}\nadd_action('get_header', 'wpcb_maintenance_mode');<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This snippet uses the <em>wp_die<\/em> function to stop the page from loading for logged-out visitors. You&#8217;ll notice the <em>503<\/em> 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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step-by-Step: Adding the Snippet with WPCodeBox<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Adding this code to your theme\u2019s <code>functions.php<\/code> 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A snippet plugin eliminates these risks by running your code independently from your theme. <a href=\"https:\/\/wpcodebox.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">WPCodeBox<\/a> 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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin-1024x588.png\" data-rel=\"lightbox-image-1\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"588\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin-1024x588.png\" alt=\"wpcodebox snippet plugin\" class=\"wp-image-1606\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin-1024x588.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin-300x172.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin-768x441.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/wpcodebox-snippet-plugin.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now that you know why WPCodeBox is the most reliable way to manage your code, let\u2019s look at the steps to add the maintenance mode snippet to your site:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Purchase and install WPCodeBox on your WordPress site. Once activated, find WPCodeBox 2 in your admin sidebar menu. This will automatically open the new snippet creation interface, where you can add your code.&nbsp;<\/li>\n\n\n\n<li>Name your snippet something clear, like &#8220;Enable Maintenance Mode,&#8221; so you can easily identify it in your list later. You can also add a brief description in the notes field: &#8220;Hides the site from guests with a 503 status code.&#8221;<\/li>\n\n\n\n<li>Paste the PHP code from the previous section into the code editor.<\/li>\n\n\n\n<li>Configure these settings in the snippet panel:\n<ul class=\"wp-block-list\">\n<li>Type: PHP Snippet<\/li>\n\n\n\n<li>How to run the snippet: Always (On Page Load)<\/li>\n\n\n\n<li>Where to insert the snippet: Plugins Loaded (Default)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click the Save button above the editor. WPCodeBox saves your snippet in a disabled state to protect your site from any accidental copy-paste errors.<\/li>\n\n\n\n<li>Review your code one last time to ensure the copied code is without any errors.<\/li>\n\n\n\n<li>Toggle the snippet to &#8220;Enabled&#8221; status to activate maintenance mode immediately across your site.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Enable-maintenance-mode-snippet-1024x666.png\" data-rel=\"lightbox-image-2\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"666\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Enable-maintenance-mode-snippet-1024x666.png\" alt=\"Enable maintenance mode snippet\" class=\"wp-image-1667\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Enable-maintenance-mode-snippet-1024x666.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Enable-maintenance-mode-snippet-300x195.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Enable-maintenance-mode-snippet-768x500.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Enable-maintenance-mode-snippet.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Enable Maintenance Mode With Breakdance (No-Code)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">What if you want to enable maintenance mode without adding any code to your website? If that\u2019s the case, you can use the built-in maintenance mode feature in <a href=\"https:\/\/breakdance.com\/\" data-type=\"link\" data-id=\"https:\/\/breakdance.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Breakdance<\/a> 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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/breakdance-website-builder-1024x606.png\" data-rel=\"lightbox-image-3\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"606\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/breakdance-website-builder-1024x606.png\" alt=\"breakdance website builder\" class=\"wp-image-1668\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/breakdance-website-builder-1024x606.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/breakdance-website-builder-300x178.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/breakdance-website-builder-768x454.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/breakdance-website-builder.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Setting Up Maintenance Mode in Breakdance<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To create the maintenance mode page using Breakdance, navigate to <em>Breakdance &gt; Settings<\/em> 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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Breakdance-maintenance-mode-settings-1024x556.png\" data-rel=\"lightbox-image-4\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"556\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Breakdance-maintenance-mode-settings-1024x556.png\" alt=\"Breakdance maintenance mode settings\" class=\"wp-image-1669\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Breakdance-maintenance-mode-settings-1024x556.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Breakdance-maintenance-mode-settings-300x163.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Breakdance-maintenance-mode-settings-768x417.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/Breakdance-maintenance-mode-settings.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You&#8217;ll need to select a specific page to display as your maintenance message. If you haven&#8217;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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/design-maintenance-page-in-breakdance-1024x460.png\" data-rel=\"lightbox-image-5\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"460\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/design-maintenance-page-in-breakdance-1024x460.png\" alt=\"design maintenance page in breakdance\" class=\"wp-image-1670\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/design-maintenance-page-in-breakdance-1024x460.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/design-maintenance-page-in-breakdance-300x135.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/design-maintenance-page-in-breakdance-768x345.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/design-maintenance-page-in-breakdance.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">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.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you prefer to watch the setup process in action, you can follow along with <a href=\"https:\/\/www.youtube.com\/embed\/0lHxDqNmAa8\" target=\"_blank\" rel=\"noreferrer noopener\">this YouTube video<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Verify Maintenance Mode is Active<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/maintenance-page-created-using-Breakdance-for-guests-1024x550.png\" data-rel=\"lightbox-image-6\" title=\"\" class=\"swipebox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"550\" src=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/maintenance-page-created-using-Breakdance-for-guests-1024x550.png\" alt=\"maintenance page created using Breakdance for guests\" class=\"wp-image-1671\" srcset=\"https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/maintenance-page-created-using-Breakdance-for-guests-1024x550.png 1024w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/maintenance-page-created-using-Breakdance-for-guests-300x161.png 300w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/maintenance-page-created-using-Breakdance-for-guests-768x413.png 768w, https:\/\/wpcodebox.com\/wp-content\/uploads\/2025\/12\/maintenance-page-created-using-Breakdance-for-guests.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">More on Enabling Maintenance Mode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How do I turn on maintenance mode in WordPress Elementor?<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in to your WordPress admin area.<\/li>\n\n\n\n<li>Navigate to&nbsp;<strong>Elementor &gt; Tools<\/strong>&nbsp;and click the&nbsp;<strong>Maintenance Mode<\/strong>&nbsp;tab.<\/li>\n\n\n\n<li>Select <strong>Maintenance<\/strong> as your preferred mode from the dropdown menu.<\/li>\n\n\n\n<li>Choose the specific template you want to display to your visitors.<\/li>\n\n\n\n<li>Click&nbsp;<strong>Save Changes<\/strong>&nbsp;to activate the screen.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How do I turn off maintenance mode in WordPress?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 &#8220;Disabled&#8221; 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How to add a coming soon page in WordPress without a plugin?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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&nbsp;<code>wp_die<\/code>&nbsp;function to display your text and a proper status code while still allowing administrators to access the site. Here&#8217;s the code snippet to add:<\/p>\n\n\n\n<div class=\"wp-block-wpcodebox-snippet wpcodebox-snippet\" data-language=\"php\"><pre class=\"line-numbers\"><code class=\"language-php\">\nadd_action('get_header', function() {\n    if ( !is_user_logged_in() ) {\n        wp_die(\n            '&lt;h1>Coming Soon&lt;\/h1>&lt;p>Our new website is almost ready. Stay tuned for our official launch!&lt;\/p>',\n            'Coming Soon',\n            array('response' => 200)\n        );\n    }\n});\n<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">More Snippets to Customize Your WordPress Site<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/wpcodebox.com\/snippet\/how-to-implement-maintenance-mode-with-secret-code-in-wordpress\/\" data-type=\"link\" data-id=\"https:\/\/wpcodebox.com\/snippet\/how-to-implement-maintenance-mode-with-secret-code-in-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">Implement Maintenance Mode with Secret Code in WordPress<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/wpcodebox.com\/snippet\/how-to-hide-content-from-logged-out-users\/\" data-type=\"link\" data-id=\"https:\/\/wpcodebox.com\/snippet\/how-to-hide-content-from-logged-out-users\/\" target=\"_blank\" rel=\"noreferrer noopener\">Hide Content from Logged Out Users<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/wpcodebox.com\/snippet\/change-wordpress-login-logo\/\" data-type=\"link\" data-id=\"https:\/\/wpcodebox.com\/snippet\/change-wordpress-login-logo\/\" target=\"_blank\" rel=\"noreferrer noopener\">Change WordPress Login Logo<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/wpcodebox.com\/snippet\/wordpress-disable-automatic-plugin-updates\/\" data-type=\"link\" data-id=\"https:\/\/wpcodebox.com\/snippet\/wordpress-disable-automatic-plugin-updates\/\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress Disable Automatic Plugin Updates<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to inform users that your WordPress site is in maintenance mode by using this clean, simple code snippet from WPCodeBox.<\/p>\n","protected":false},"featured_media":1672,"template":"","meta":{"_acf_changed":false},"tutorial-category":[8],"class_list":["post-1664","tutorial","type-tutorial","status-publish","has-post-thumbnail","hentry","tutorial-category-how-to"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/tutorial\/1664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/tutorial"}],"about":[{"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/types\/tutorial"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/media\/1672"}],"wp:attachment":[{"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/media?parent=1664"}],"wp:term":[{"taxonomy":"tutorial-category","embeddable":true,"href":"https:\/\/wpcodebox.com\/wp-json\/wp\/v2\/tutorial-category?post=1664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}