WordPress – All Your Content has Vanished / Error 404 on All Pages

These instructions are for WordPress 3.X that is being hosted on a web server that provides access via cPanel version 11.34.1.

The instructions may be the same or similar for other version combinations or interfaces other than cPanel, but no guarantees are made.

Possible Symptoms

You may encounter one or more of the following symptoms:

  • All content and comments on your WordPress site have vanished:
  • All content and comments show as having vanished in the dashboard:

  • Trying to go to a particular page (that you know exists) results in an Http 404 Not Found message:

  • You get a database connection error message:

Possible Cause – Corrupted Database

While it is possible that you have been hacked, it is far more likely that your WordPress database has become corrupted and is no longer able to serve up content.

I am not sure why this happens, but between November-2012 and March-2013 this has happened four times to me.

Fixing the Problem

There are two ways to fix this problem: (1) restore the database from a backup copy (preferred), (2) fix the database (only if you don’t have a backup).

Checking if the Database is Corrupted

Before doing anything rash, it is always best to check that a corrupt database is the problem.

1) Log into your web hosting account (this is not your WordPress powered website). If you web host provides a cPanel interface, it might look something like this:

2) Click on MySQL® Databases:

3) Locate the section titled Modify Databases. Select your database in the Check DB listbox and click on the Check DB button:

How the databases are named, may depend on your service provider. If you have only one website and one database, then finding the correct one is easy.

If you have multiple websites or databases, then you my need to determine which database is which. In my case, I have WordPress and Joomla databases which can be identified by the suffix.

4) Verify whether the database has errors or not. If the database comes up without warnings or errors then you have a different problem that will not be fixed by this tutorial. If it does have warnings or errors, then the steps in this tutorial may help:

Fixing the Database

This is not the preferred method, but it is likely that most users do not have an up to date backup copy of their database.

If you do have an up to date backup copy of your database, then proceed to the next section.

1) Click on MySQL® Databases:

2) Locate the section titled Modify Databases. Select your database in the Repair DB listbox and click on the Repair DB button:

How the databases are named, may depend on your service provider. If you have only one website and one database, then finding the correct one is easy.

If you have multiple websites or databases, then you my need to determine which database is which. In my case, I have WordPress and Joomla databases which can be identified by the suffix.

As the database is being repaired, confirm that there are no errors. If there are errors, then run the Repair DB again (I have had to run it up to two times to repair a database):

After this is done, I strongly recommend verifying that all your content is present and intact.

While I have not had a problem with this method, I can see cases where the database is not correctly repaired and content gets lost or is corrupted.

Restoring the Database from a Backup

This is the preferred method and presumes you have an up to date backup of your database.

1) Click on Backups:

2) Locate the section called Restore a MySQL Database and click on Browse… and select the backup database from your computer. Click to upload the database.

During this process, not much may seem to be happening.

The backup database has to be uploaded from your system to your service provider.

Once it is uploaded to the service provider, the existing database is rebuilt from the uploaded one.

The whole process looks something like this:

Note: Having up to date backups of your website and associated files is essential to being able to correct any problems that occur.

Hopefully, we never have to use it.