How to deactivate a WordPress site

It may happen that for some reason you Deactivate WordPress site or have to switch off at short notice. In this article I will show you how to get your website into the WordPress maintenance mode in the quickest and most convenient way. Are you in?

In which cases it makes sense to want to deactivate a WordPress site

There are a number of situations in which you cannot avoid switching off a WordPress site.

Examples would be

  • The site has been attacked by hackers and needs to be cleaned.
  • Your website has critical information that needs more time to be removed.
  • You want to test a new theme before you put it live.
  • You want to test new plugins in peace.

In an ideal world, you wouldn’t be doing all of these things on a live site, but in a development environment or what is called a staging environment.

But sometimes the world is not ideal. Time pressure, urgent WordPress maintenance, lack of resources or pressure from the customer force us to do things on a live site from time to time.

So that you can do this in peace, I will now introduce you to several ways that you can temporarily shut down a WordPress website.

Deactivate your WordPress site without a plugin via the functions.php

Anyone who knows me a little knows that I’m not the biggest fan of plugins. At least not when there is a simple and quick solution to a problem.

For me, quick solutions are always those that do without the help of a plugin and only need a small code snippet.

With such a code snippet you can also deactivate your WordPress site. Just add the following code to the functions.php of your theme or child theme:

// Activate WordPress Maintenance Mode
function wp_mighty_maintenance() {
    if (!current_user_can('edit_themes') || !is_user_logged_in()) {
        wp_die('<h1>Wir bearbeiten gerade diese Seite.</h1><br />Solange die Arbeiten andauern, ist diese Seite leider abgeschaltet. Besuche uns bald wieder!');
add_action('get_header', 'wp_mighty_maintenance');

With this function we put WordPress into an artificial sleep, the maintenance mode. Your visitors will just see a short notice on a white page pushing out info about it.

The trick: this message is only visible for normal visitors. All logged-in users see your website as normal. As an admin, you can work on your website in peace and do what you want to do.

Deactivate the page via the .htaccess

The .htaccess file is a very, very powerful tool. That is why it is also important to use this tool as carefully as possible.

Do you dare? Then I will now show you how you can deactivate your WordPress site by editing your .htaccess file.

This is the code that needs to be in your .htaccess file:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^123.456.789.123
RewriteCond %{REQUEST_URI} !^/offline.html$
RewriteRule ^(.*)$ [R=307,L]
  • Create an HTML page named offline.html according to your taste. How you design the site is entirely up to you.
  • Place this file in the root of your website. So straight into the Web Binder.
  • Paste the above code into your .htaccess file.
  • Adjust the numbers in the 3rd line (the line that says {REMOTE_ADDR}) to your own IP address.

Why do you have to enter your IP address?

I saw the question coming πŸ™‚

The code above redirects all requests from your visitors to the offline.html file. So every visitor will see this file instead of your actual website.

So that you can work on the site yourself, enter your IP address in the .htaccess file. Then all requests coming from your IP address are excluded from the deactivation of the website.

You can find out your current IP address via this website. Just keep in mind that your provider will assign you a new IP address every 24 hours. So you have to update the code regularly with your current IP.

2 quick fixes for disabling a WordPress site with plugins

Of course, you can also do this with the help of plugins. I will now introduce you to 2 plugins that I have already worked with and deactivated WordPress sites.

Fast shutdown with the maintenance plugin

I have used this plugin many times myself and have always been satisfied.

The free maintenance plugin doesn’t have the most features of all deactivation plugins, but let’s be honest: we only want to shut down a website temporarily, right?

The maintenance plugin is configured and switched on very quickly. If you run an English-language website, you don’t really need to set anything.

For the likes of us with a German website, only a few short texts need to be translated and that’s it.

If you feel like it, you can of course use one of the extended features:

  • Custom background image for your deactivation page.
  • Custom CSS to customize the design of the page a bit.
  • Insert a Google Analytics ID if you want to measure the traffic landing on your maintenance page.
  • Output of a 503 Temporarily unavailable response code (can be selected separately).

By the way, the plugin only switches off the page for your visitors. The page can be called up as normal for all logged-in users.

I find it particularly pleasant that a pro version of this plugin is not advertised to you all the time, like sliced ​​bread. With all due respect to the performance of the developers. But for a maintenance mode you don’t really need a plugin with pro features.

Maintenance mode with the SeedProd plugin

The SeedProd plugin is the second plugin for a quick deactivation of the WordPress site. Actually the plugin is called “Coming Soon Page, Under Construction & Maintenance Mode by SeedProdβ€œ. But who wants to remember that? πŸ˜‰

The plugin currently has over 1 million active installations and has a clean 5-star rating.

The main functions include:

  • Responsive display of your maintenance page.
  • Ability to add custom CSS and HTML to the page.
  • All areas of the plugin can be translated. Mostly via directly via the backend. Other parts can be controlled via Language Files.

SeedProd also offers a Pro version that starts at $29.60 per year. But as I wrote above, I find a Pro version for a maintenance page plugin a bit overkill.

But maybe it’s just the Scot in me who’s too stingy for that πŸ˜‰


There are a number of ways to deactivate or put a WordPress site into maintenance mode.

If you know your way around, you can and should try and use both options without a plugin. As a beginner, I recommend using one of the two plugins presented.

So you are on the safe side and have solved your problem very quickly.