There are three ways to tackle corrupted files in WordPress. For the best results, you’ll want to approach these solutions in the order they appear. Plus, you’ll need to use a File Transfer Protocol (FTP) client for all three methods. We recommend FileZilla, but you’re free to use whatever program you’re comfortable with.

1. Restore Your Website From a Backup

Restoring a website.

Restoring a recent backup is the easiest way to fix plenty of errors.

Backups can solve basically any problem you have with your website. Ideally, you’ll back up your site often, so you can simply restore it to an earlier version if anything goes wrong, without losing too much content.

In other words, doing a full restore (of your files and database) is the perfect way to reverse corruption on your installation. If you have a backup plugin, such as UpdraftPlus, you should be able to restore your website from your dashboard using our previous guide on the subject.

On the other hand, if you can’t access your dashboard, things get a bit more complicated – although they’re still solvable. Depending on your web host, you may have access to automatic backups or a server restore feature that’ll enable you to roll back things to an earlier state. For example, Flywheel sets up automatic daily backups for you, letting you to restore them with a couple of clicks:

Flywheel restore feature.

If your host doesn’t provide this option and you can’t access your dashboard, you’ll have to restore your site manually. As long as you have a recent backup file saved locally or to cloud storage, you can restore it within a handful of steps (otherwise, proceed to the second method). The backup should contain a database file, your plugins, themes, uploads, and other files. To restore your database, you’ll need to access the phpMyAdmin tool within cPanel. Once you’re in, locate your WordPress database, select all of its tables and use the Drop option to delete them:

Dropping your database tables.

Now that you have a clean slate, go to the Import tab within that same database and look for the Choose File button:

Importing a database.

Find your database backup file, which should be in the .sql format, and select it. Now click on the Go button at the bottom of the Import tab. The process should only take a few seconds, and once it’s complete you’ll see a success message. If you go back to the Structure tab, you should see that it’s no longer empty:

phpMyAdmin's structure tab.

The final step is to restore your WordPress files. Access your server using your FTP client and head to WordPress’ root directory. In most cases, it’s called public_html, but it also may be under www or named after your website:

WordPress' root folder.

Open that folder, select all the files inside, then right-click and delete them. Next, stay within the folder while you re-download WordPress’ core files from its official website. Most backups only include your theme, plugin, and upload folders, so you’ll need to ‘set up’ the rest of WordPress separately. When the download is complete, unzip the file, return to your FTP client, and access the local wordpress folder:

The local WordPress folder.

Select all of those files, then right click and upload them. If you’ve followed our instructions and kept your FTP client open, they’ll go right where your old WordPress setup used to be. This process can take a while, since there are a lot of files. When that’s done, go to wp-content/plugins and upload all of the plugin folders within your backup file:

Your plugins backup folder.

This process is simple – just select all the folders you want to restore and click on the Upload option within your FTP client. Then repeat the process for your themes (which go into wp-content/themes) and uploads (located in wp-content/uploads). After you finish all three rounds of uploads, you should be able to access your site again without errors. If you went through all this process from an old backup, remember to schedule regular ones in case it happens again!

2. Repair the WordPress Database

A list of databases.

Your database can also get corrupted, which can break your WordPress site.

If backups are out of the question (because you don’t have any recent ones), you should first look to repair your database. WordPress includes a built-in feature that enables you to do this, but it’s turned off by default.

To activate it, return to your FTP client and go to the WordPress root directory. Inside, you’ll find a file called wp-config.php. Right-click it and look for the View/Edit option. This will open the file locally using your default text editor:

Opening your wp-config file.

Once you’re in, look for the line reading That’s all, stop editing! Happy blogging. This comment signals the end of the file, and you paste the following line right above it:

define( 'WP_ALLOW_REPAIR', true );

Technically, you can add that line anywhere in the file you want. However, it’s best to place it right at the end, so you can be sure it doesn’t interfere with the rest of the file’s code. Once you’ve enabled WordPress’ database repair function, you can access it by navigating to

A new screen including two options will pop up – click on Repair Database:

Using wp_allow_repair to repair your WordPress database.

Now, wait for WordPress to work its magic. When the repair is done, you should be able to access your site without any errors. However, if your site is still facing problems, it’s time to try out method number three.

3. Replace WordPress’ Core Files

Some of WordPress' core files.

WordPress core files are critical to your website’s functionality.

If you couldn’t restore your website from a backup or repair your database, you’ll simply need to replace all of your WordPress core files. This process is rather straightforward, but it will cause you to lose any customizations you’ve made to any of those files.

To do this, download the latest version of WordPress from the platform’s home page and unzip it. Now open both your FTP client and the WordPress folder you just decompressed as your local directory:

Your WordPress local directory.

Keep that folder open for now while you access your site via FTP on the other side of the screen. Next, navigate to WordPress’ root folder, select all the files in your local wordpress directory, and upload them:

WordPress' root folder.

At this stage, your FTP client will ask you if you want to overwrite any duplicate files on your server. Choose “Yes” for all files, and sit back while everything uploads. This process should only overwrite your WordPress core files, and it won’t affect any plugins or themes you’ve downloaded. In fact, you can use this same process if you ever run into a situation where you need to update WordPress manually.

When everything’s done, go ahead and try to access your site once more – it should now be working perfectly!


Troubleshooting WordPress can seem intimidating, but in most cases, it’s rather simple. Once you identify what’s wrong with your site, you’ll likely find dozens of guides on how to deal with it. Corrupted file errors are a bit more complicated, since they can have many causes. However, you can still make short work of them if you investigate the problem methodically.

Here are the three best ways to fix corrupted files in WordPress, and the order in which you should approach them:

  1. Restore your website from a backup.
  2. Repair your database.
  3. Replace your WordPress core files.


Source: How to Fix Corrupted Files and Databases in WordPress | Elegant Themes Blog

Pin It on Pinterest