Manually open WordPress site maintenance mode

WordPress six 1.2K Reading mode

In the update program or plug-in, the front end of WordPress will show that it is in maintenance mode. If you want to temporarily enable the maintenance mode, customize the front end prompt text to let users know that your site is in maintenance, rather than running away from the door, you can use the following code to achieve this.

 Manually open WordPress site maintenance mode

Enable WordPress site maintenance mode

Add the following code to the current topic function template functions.php:

 function zm_maintenancemode() { if ( !current_user_can( 'edit_themes' ) || ! is_user_logged_in() ) { Wp_die ('Please wait while the website is being maintained! '); exit; } } add_action('get_header', 'zm_maintenancemode');

After the code is added, the front end will show that the maintenance is in progress without logging in, but it will not affect the login background operation.

source: http://www.thecreativedev.com/how-to-put-wordpress-site-into-maintenance-mode/

Most of the articles on this site are original and used for personal learning records, which may be helpful to you, for reference only!

 weinxin
My Wechat
Copyright Notice
Please indicate the source and link of the original article reprinted on this site. Thank you for your cooperation!
five hundred and ninety-eight million eight hundred and forty-five thousand and six
 
 Robin
  • WordPress
  • functions.php
five hundred and ninety-eight million eight hundred and forty-five thousand and six
Comments six    Visitors five    Author one
    •  Notes of Daddy Building Website
      Notes of Daddy Building Website four

      Generally, I will install a coming soon plug-in so that the front desk administrator can view it and modify the theme easily.

      •  Ali Stage
        Ali Stage two

        Please consult Brother Bird. I have enabled the user registration function. At present, ordinary users can view each other's user information. I want to set this to disable viewing. I don't know how to write code?

          •  Ali Stage
            Ali Stage two

            @ Ali Stage Later, this problem was solved with an alternative method. Viewing user information is a function under the main theme of the dual theme plug-in that I enabled. I jumped to the sub theme of this link, and it will not be displayed.

          •  Strangers, shadows
            Strangers, shadows one

            It would be even more perfect if you could enter several pages and jump to several pages like discuz

              •  Robin
                Robin

                @ Strangers, shadows This function has been available for a long time. It can be realized with four lines of code without plug-ins

              •  The Way of God of Wealth
                The Way of God of Wealth zero

                For our new station: the third-party payment service cloud, let's learn!

               anonymous

              Comment

              Anonymous netizens
               :?:  :razz:  :sad:  :evil:  :!:  :smile:  :oops:  :grin:  :eek:  :shock:  :???:  :cool:  :lol:  :mad:  :twisted:  :roll:  :wink:  :idea:  :arrow:  :neutral:  :cry:  :mrgreen:

              Drag the slider to complete validation