How to Close a WordPress Site

I recently was asked to close down a site I had put up using WordPress. I didn’t want to just delete the whole thing, as I figured somebody might want it put back up in the future. There are several easy ways to do this, but I think I’ve found the best.

My first impulse was to add an exit; line to index.php. The problem there is that it doesn’t close off the wp-admin section. I could comment out the database password in config, but that leaves a “Could not connect to database” message. I wanted every aspect of the site gone. Then it struck me: One file that absolutely every single call to WordPress must pass through is wp-config.php.

So if you want to “disappear” a WordPress site quickly and easily, just open up wp-config.php and add the following right after the opening PHP tag:

exit;

If you want to put up some kind of “goodbye” message in HTML, you can do something like this at the top of that file:

<?php
?><!DOCTYPE html>
<html><body><p>This site is closed.</p></body></html>
<?php
exit;

...

Even more briefly, of course, you could stick a short message inside a die() statement. The HTML gives you a bit more flexibility though.

Hope somebody finds this useful. ;-)

This entry was posted in 'Nuff said, Webcraft and tagged , . Bookmark the permalink.

6 Responses to How to Close a WordPress Site

  1. Navegante says:

    Thanks!

    I was looking for this ;)

  2. Bob Austin says:

    This worked! I have been trying to do this without success. Now is there any way to put an Image rather than “out to Lunch”?

  3. Kunal Sharma says:

    Its very useful … Your trick is just an example of ‘Keep it simple Silly’ … :)

    I just wanted to make someone fool that there is some technical fault and I did it … ;) I’m your fan..

  4. I have a web site run by WordPress I wish to take down immediately. I have very limited knowledge of WordPress and HTML, but I can follow directions so long as the person(s) giving them can write explicitly and plainly, and use terminology which doesn’t require a programmer’s education. By this what I mean is, referencing the above, “Then it struck me: One file that absolutely every single call to WordPress must pass through is wp-config.php.

    So if you want to ?disappear? a WordPress site quickly and easily, just open up wp-config.php and add the following right after the opening PHP tag:

    exit;”

    I have no idea what the author is talking about. I understand his intent, and that his desire is to eliminate a web site, similar to mine, but I have no idea what the wp-config.php is, where it can be found, or how to proceed once I have arrived at this place.

    Could you provide a more explicit definition/explanation of what he is trying to communicate?

    Thank you,

    KB

    • Stephen R says:

      Keith — You don’t do it within WordPress. You access your site via FTP so that you can directly see the HTML or PHP etc. files that make up your site. Edit the file called wp-config.php and do as instructed.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>