Repairing Corrupted, Broken or Missing Files and Databases in WordPress-ThemesReviewCentral

Have you found that your WordPress site’s on the fritz and all you can say is “I didn’t do anything, I swear!?” Yet, you see errors that say your files or database are broken, missing or corrupted.

Anything from posts and categories sporadically disappearing and reappearing to error messages like:

Not to worry because today, I’ll explain how these kinds of broken, missing and corrupted errors happen, how to fix them and most importantly, I’ll share why it’s more than likely not your fault.

It can be difficult to track down the exact cause of any of these errors because there’s an unfortunate number of probable causes.

Here are the top reasons why your database could be corrupted, missing or otherwise broken:

There’s also an even larger list of top reasons why your files could be in the same situation:

No matter what the reason, there are a few ways you can fix your files or database.

The absolute easiest way to fix and broken file or database issue is to restore your site from a working backup of your site. If you don’t have a backup that you can restore, then there are other fixes that you can try.

Before you do give the other options a shot, you should backup your entire site. Even if it’s broken, things could still get worse so it’s better to have something rather than nothing at all.

Here’s a list of posts you can check out for details on backing up your site:

Once your site is all backed up and waiting on the sidelines in case disaster strikes, you’re ready to fix your site.

There are a couple ways you can repair a broken database.

If you’re seeing a “Cannot establish database connection error,” you can check out this post for details on how to fix it: How to Fix “Error Establishing Database Connection” for WordPress.

There’s also one more thing you can try that works for most issues including the event that your database is corrupted.

You can add this line to your wp-config.php file, which is located in the root of your install:

You can add it anywhere in your file as long as it isn’t smack dab in the middle of a function, for example. I recommend placing it right before the following line:

For details on how to edit your wp-config.php file, check out the How to Use FTP Properly with WordPress post for more details.

Once you have added the line mentioned above, you can visit the database repair page: http://your-site.com/wp-admin/maint/repair.php and if you have an SSL certificate installed, you would visit https://your-site.com/wp-admin/maint/repair.php.

Don’t forget to replace your-site.com with your actual domain.

Keep in mind that you don’t need to be logged in to view this page so when you’re done repairing your database, be sure to remove the line mentioned earlier. Otherwise, anyone could get to that page.