As with any software, sometimes you will encounter an issue on your WordPress site where the best solution is a full reinstall. For example, you might be faced with corrupt files, unexplained errors, or accidental changes. With software as complex as WordPress, you never know when you may need a fresh reinstall to fix an issue.
You can reinstall WordPress quickly and easily from the Updates tab in your Dashboard. If you need to dig deeper, you can manipulate the files in your website’s root directory to replace only the suspect files.
Reinstalling the core WordPress files can save you time and effort versus troubleshooting all of your site’s files and code looking for errors. With the click of a button or some manipulation in your root directory, you can have your site running a fresh WordPress install free of bugs.
In this article, we will cover the reasons you might need to reinstall WordPress, and discuss how to do so safely. Let’s get started!
Why You Might Need to Reinstall WordPress
Running into an unexpected problem with your website can be scary and frustrating. Sometimes the problem is clear-cut, but other times it can be difficult to pin down the source of the issue and figure out a solution.
For example, if you conduct a WordPress update and afterwards your site is behaving strangely, you know the general cause of the issue. However, you probably don’t want to undo the entire update, and it may not be obvious what caused it to misbehave. You could try troubleshooting all of your plugins and code to look for conflicts, but an easier solution might be to just reinstall WordPress.
If the update was interrupted or an exception occurred during the process, it may simply have been a fluke that corrupted your update. Reinstalling the latest version of WordPress should clear up the issue. Similarly, this can be a simple fix to many problems you might encounter on your website.
How To Reinstall WordPress Without Losing Data (In 4 Steps)
While reinstalling WordPress can be beneficial, you do risk losing data or changing settings that you have fine-tuned over time. WordPress is the backbone of your website, so you need to be very careful when removing it to ensure that you will be able to put it back the same way.
It is better to be too careful during this process than to risk losing content along the way. The last thing you want to do is create more problems for yourself by losing data during reinstallation!
Step 1: Back Up Your Important Files
For peace of mind, it is always a good idea to back up your website before making any significant changes to it. In addition to a full backup, it may also be a good idea to export any data that is extra sensitive or would be easier to import back in from an external source.
Fortunately, WordPress does a good job of grouping like content together. If you know where to look, you can easily find all of the data for your plugins, WordPress settings, and more:
A more hands-on approach for creating backups is to simply locate and copy these files into a temporary folder where they can be moved back after reinstalling WordPress. For example, you can find all of your plugin data by logging into your site via File Transfer Protocol (FTP) and looking under the /public/wp-content/plugins/ folder. Simply copy it to a safe place for a backup of all your installed plugins.
The more exhaustive approach is to run a dedicated backup of your entire website. This can be done with a plugin such as Jetpack, or your hosting service may already run regular backups for you. With a full backup of your website, you can revert back to a previous version in the event that something else goes wrong.
Step 2: Remove Unwanted or Suspect Files
If you suspect that any particular files may be the cause of the error you’ve encountered, you can take them out before reinstalling WordPress to ensure that they are eliminated. For example, if you see any corrupted files in your site’s root directory, you should try to determine what they are and then delete them prior to reinstallation (if necessary).
While the reinstallation process should overwrite any corrupt WordPress files, removing them at this stage ensures that they won’t interfere with the process or rear their ugly heads in the future. You should also keep an eye out for corrupt or malicious files outside of WordPress core, such as in plugins or themes, as these could be causing problems with your site.
You may want to run another backup after removing any unwanted files, or even test your site without them. If you think a corrupt file is causing the issue, you can even attempt to replace it by itself instead of performing a full reinstall.
Step 3: Activate Maintenance Mode on Your Site
Before moving ahead with the reinstallation process, or if your site is already down from the errors you are troubleshooting, you’ll want to activate maintenance mode. This will let your visitors know what is going on, and could imply that the downtime is intentional. It is much better for your visitors to see that your site is under maintenance than to receive an error or see that your site is broken.
The SeedProd plugin makes it easy to switch your site into maintenance mode. It also allows you to customize your maintenance mode page to create a more informative and attractive landing page for your audience:
Simply flip the switch to activate maintenance mode before beginning the reinstallation process, and turn it back off once everything is up and running again. You could even modify the page with a message explaining the issue or giving an estimated time when things will be back to normal.
Step 4: Reinstall WordPress
There are a few methods for reinstalling WordPress, depending on how deeply you need to manipulate your files. The easiest option is as simple as clicking the Reinstall button in the Updates menu:
This will simply reinstall the latest version of WordPress core as if it were an update:
However, while this method can overwrite corrupted files, it may not be enough to solve your problems. For a more thorough reinstall, you can manually remove all of the files from your root directory via FTP, and then install a fresh copy of WordPress.
In this case you can either install the newest version of WordPress, which may help resolve your issues, or reinstall your current version. As we discussed earlier, be sure to have a backup of any important files or content you will want to add back afterward.
For example, if you don’t think the problem is related to your plugins or themes, you can make a copy of the /wp-content/ folder so you can add it back after reinstalling. Other files worth saving are wp-config.php and wp-settings.php, as these include site settings you would otherwise have to reconfigure after reinstallation. Note that if any of these files are related to the issues with your site, adding them to your new installation may recreate the problem.
Now that you know how to reinstall WordPress without losing data, you will be ready for situations when your site is broken or corrupted and needs a refresh. While this hopefully won’t happen often, there are situations when a reinstall can save you a lot of time and stress.
When reinstalling WordPress, remember to follow these steps:
- Back up any files you want for the future.
- Fully remove any questionable files.
- Activate maintenance mode on your site.
- Reinstall a fresh copy of WordPress and add old data.
Do you have any other questions about reinstalling WordPress? Let us know in the comments below!