Home / functions.php / Maintenance mode without plug-in
  • Pingback: Tweets that mention Wordpress Maintenance mode without plug-in – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com()

  • Ryan

    The last time I tried the built in maintenance mode I was blocked from the admin too, even with an admin account. Will this still be the case?

    • Kevin Chard

      Hi Ryan,
      You should be fine with this maintenance mode, In fact I use a similar plug-in. Keep in mind you will need to go right to the login page to access the admin. yoursite.com/wp-admin/ should get you in or yoursite.com/wp-login.php

      If you notice this sample has the code
      if ( !current_user_can( ‘edit_themes’ ) || !is_user_logged_in() )
      if the user can’t edit themes or is not logged in then display the maintenance mode message. This should work the same way for any plug-in.

      I should note that if you ever get stuck you can always login with FTP and delete the plug-in or in the case of this snippet download and remove it from functions.php and upload the updated functions.php if you have any problems.

  • Ryan

    I see now, that makes sense :)

    Thanks again.

  • Kevin, I loved you old wp theme, can you send me it?

  • maintenance or maintenace? is it typing error or it’s just me as another WordPress newbie?

  • J Hardy

    can you use this and make it load a custom maintenance page within the theme?

    • I’m sure you can, I use wp_die() and that kills the execution and displays and error message. But you could have the snippet redirect or since it hijacks the get_header you could give it HTML for a special page you wish to load.

  • Serradinho Web Services

    This is a nice code snippet, but it’s not really user friendly as user will have to edit functions file. I have taken the above as a basis and creating my own admin page with select dropdowns and textarea for information.

  • Tan

    How can I add a login box for admins?

  • Thanks for the snippet! This one works for my blog! :) Just the code I’m
    looking for since I don’t want to install maintenance plugin.