Maintenance Mode in WordPress

    There are many occasions when we need to disable the WordPress blog online, either for reasons of maintenance, for internal needs or to be able to carry out improvements or change of templates or content In it, the truth is that many users are not clear about how to enable Maintenance Mode in WordPress without using the features of Hosting.

    curiously WordPress It has a maintenance mode when updates are made from the administration, making it inaccessible to users during this period of time, showing a notice of this process.

    While it is true that this process is sometimes so short that users in the frontend many times they do not even perceive it.


    So let’s see how to enable Maintenance Mode in WordPress easily.

    The native method is carried out automatically, WordPress creating the file .maintenance (file hidden on UNIX systems) It is also removed only once the process is complete and as long as the process is not interrupted by the user.

    Maintenance mode without plugins the better!

    Anything that helps reduce the load on a website should always be welcomed with open arms, after all, in addition to reducing the stress of loading and querying the database, it helps to clear the installation of additional code, without forget that the plugins must be monitored, updated and expected from them that they do not have bugs hidden that end up affecting the web or destabilizing functionalities of other plugins.

    Any task you can do in WordPress using snippets, functions or filters is always more recommended in the long term than the use of plugins.

    Plugins make everything easier for us, that’s true! but they also leave us at the mercy of code that doesn’t always comply with the programming pattern promoted by

    It’s so easy to be seduced by a plugin that claims to do this or that, the temptation not to install it is just 1 click away.

    But you should not get carried away by first impressions, sometimes the plugins hide too many functionalities that later we did not end up using and the only thing we end up doing is mounting a competition engine in a utility car it is necessary?

    You need your WordPress site not to be visible while making changes, customizations, or because you are changing the theme or layout of widgets, Activate Maintenance mode It allows you to continue working on it without it being publicly visible.

    So let’s use a function (short code that relies on defined WordPress functions to perform actions or return values, states, etc.) to display a warning screen to web visitors warning them that we have temporarily closed the web site for renovations, extraordinary work or whatever is appropriate.

    How does this function work?

    Very easy. Once you insert it into the file functions.php and save the changes, maintenance mode is activated.

    All visitors who access and are not identified as administrators will see a page of site maintenance.

    You, as administrator, will continue to see the website, you will not need to filter your IP so that the front of the web is allowed to be displayed, but the rest of the users will not see the page.

    Once you finish editing, changing theme, desired customizations etc., just delete the code or put it pause until you need to activate it again.

    The function code pauses it by adding a double bar // before each line of the function.

    How to add the function?

    From WordPress 4.9 onwards, protection mechanisms have been introduced, by WordPress developers, in the edition of certain files to avoid 500 errors on the web or others. So when you try to edit a file from the WordPress dashboard, Appearance, Editor, the error appears:

    It was not possible to communicate with the site to check for fatal errors, so the PHP change has been reversed. You will have to upload the change to your PHP file by other means, such as using SFTP.

    To apply this function in a simple and effective way, the ideal is to access your Hosting Panel, and in Files, with the File Manager (cPanel users), go to the folder where the file is located functions.php and edit it with the editor of your filemanager or file manager of the Hosting (you can also edit it by FTP). Then you go to the end of functions.php and add after the <? Php} code (your theme may not necessarily close functions.php with that code) the following function:

     /*** Inicio Modo Mantenimiento ***/ function mode_maintenance(){     if(!current_user_can('edit_themes'') || !is_user_logged_in()){         wp_die('

    Sitio en Mantenimiento

    Estamos trabajando en el nuevo sitio ¡en breve estaremos online!

    ‘, ‘Sitio en Mantenimiento’, array( ‘response’ => 503 )); } } add_action(‘init’, ‘mode_maintenance’); /*** Fin Modo Mantenimiento ***/

    The result will look like you see in this screenshot.


    From this code you can imagine how to add a section of links to your social networks, insert a form (preferably from a field) so that they subscribe to your newsletter, a background image, etc.

    And after activating Maintenance Mode?

    Basically Work on site! as long as you are logged in before activating this mode and do not disconnect from the dashboard in the browser you are working on. From a different browser you can, for example, load the website to check that the “maintenance mode” is active, even if you continue to view the website from your current browser.

    No access to wp-admin with Maintenance active?

    This feature limits access to both the frontal from the web like at dashboard, so in order to deactivate maintenance mode and then log in to you must first comment or delete the function inserted in functions.php otherwise you will not see the login form.

    You have to access your Hosting Panel (cPanel), Files, File Manager, and navigate to the folder / wp-content / themes / and edit functions.php, locate the function code at the end and enclose it between / ** function code * / to stop being functional.


     /** /*** Inicio Modo Mantenimiento ***/ function mode_maintenance(){     if(!current_user_can('edit_themes'') || !is_user_logged_in()){         wp_die('

    Sitio en Mantenimiento

    Estamos trabajando en el nuevo sitio ¡en breve estaremos online!

    ‘, ‘Sitio en Mantenimiento’, array( ‘response’ => 503 )); } } add_action(‘init’, ‘mode_maintenance’); /*** Fin Modo Mantenimiento ***/ */

    In this way that code block is commented and you regain access to the front and the dashboard.

    WordPress maintenance plugin

    Let’s use a plugin to apply the closing of the web to visits, but that allows us to continue working from the dashboard and that if possible see the changes that are being applied, but only to the Administrator.

    WP Maintenance Mode

    Click on the image to go to the plugin link

    This plugin add a welcome page to your WordPress website that allows visitors to know that the site is closed for maintenance or development, leaving administrators access to administration and frontend from the blog.

    It is interesting to have this plugin since there are many users who for updating your blog, the WordPress version, for temporary closure or other reasons need to indicate that the site is under maintenance and they are not clear how to carry out such action.

    With this plugin you can indicate to regular users and new visitors the state of the website, preventing tasks from being performed, adding new content or comments on the site, especially if you are updating the WordPress version and need it not to write data to the database in use.

    The plugin is translated into several languages ​​that are incorporated by default such as English, Russian, German, Greek, Portuguese, Italian, Japanese and French.

    Plugin Features:


    • Supports WordPress Sites Network (multisite).
    • Use Responsive Design.
    • Activate social media icons.
    • It works with any WordPress theme.
    • You have SEO options.
    • Lets you exclude URLs from maintenance-mode-with-the-underconstruction-2020-plugin-e-commerce-revolution” target=”_blank” rel=”noopener noreferrer”>maintenance mode.

    Installation and use of the plugin

    Performing the installation of the “Maintenance Mode” plugin is a simple process and common to any WordPress plugin.

    • Make a backup of the web (manual or with All In One WP Migration).
    • Go to Plugins, Add new, and locate the plugin in the search engine.
    • Click Install and then click Activate.
    • Go to Settings, WP Maintenance Mode to configure the plugin according to your needs.

    You can see the configuration details in the following 3 images.

    Maintenance Mode Plugin Configuration

    In the tab Design You can put a title and a heading, in addition to the text that will be visible from the front of the page. You can also add a background (loaded or predefined) or uniform background color.

    Maintenance Mode plugin configuration design

    Naturally, it is recommended to customize this message according to the needs of each one from the plugin options.

    And finally, before activating the plugin definitively, check the tab Modules and apply all the customizations you consider appropriate.

    Maintenance Mode plugin configuration modules

    Now, when you activate maintenance mode, users will see the following message on the cover:

    Maintenance mode activated

    If you don’t see it, it is because you are connected to the page as Admin and you need to log out or open a new browser window in Incognito mode to be able to test this functionality.

    Installation and use video

    In the following video I show you how this plugin is installed and its basic use.




    Naturally this process is for when you need it close the Blog by development, Topic change or temporary closure The same for other reasons, such as collaborating with “Earth Hour”, for example.

    The ultimate goal of this type of action is to be able to make changes to the Blog (templates, content, etc.) that do not compromise the operation of the same or cause unnecessary problems in the database.

    And don’t forget that on site or new projects, in the development phase too it is important to prevent access to indexing bots so that later you do not find in Google things that were not finished or if they were under a temporary url.

    Member of the Websites Are Us technical team.
    Coordinator of content on the Blog and YouTube.
    Technical support in CyberProtector. Teacher at Websites Are Us Learning.

    Leave a reply

    Please enter your comment!
    Please enter your name here