Are you having the WordPress corrupted file issue? Then learn how you can reinstall your WordPress files without losing your website data in this post.
The WordPress CMS has some core files that are super important to make it functional. If for some reason these core files get corrupt, you might face issues with your website. Doing a complete re-install of WordPress will restore all your core files. This will replace the corrupt files and might also resolve your issue.
You can even do this while retaining all your data. There is also an option to do a complete re-install where your data won’t be preserved, but this guarantees a 100% fresh reinstall.
There could be many reasons for which your WordPress site might behave strangely. If you suspect that your WordPress site is hacked, then you must take decisive action to fix it. While reinstalling WordPress might solve various issues, consider all your options before proceeding.
Whether you want to do a reinstall while preserving all your data or you want to do a 100% reinstall, we got your back. In this post, we’ll learn how to reinstall WordPress without losing data. Also, we’ll show how to reinstall WordPress as a blank site. You’re covered in every way!
Before proceeding with the re-installation process, we request you to make a backup of your WordPress website. It’s highly recommended, in case something goes wrong.
How to reinstall WordPress without losing data
The following methods that we will be showing are how to reinstall WordPress while keeping your files safe. The following files/data will be saved:
- Website content
- Themes
- Plugins
On a more technical side, the following files will not be affected by the re-installation process:
- Database
- wp-config.php
- wp-content folder
This method only re-installs the core WordPress files.
How to reinstall WordPress from WordPress Dashboard
You probably knew this method of re-installing your WordPress core files. You can actually do it from within your WordPress dashboard. Go to Dashboard > Updates and click on Re-install version x.x.x. (whatever version you are using)
Once you click here, WordPress will automatically download all the core files and replace the old files.
WordPress will actually download and implement the latest files. This is basically the update process that WordPress automatically launches, you are manually doing it from the WordPress dashboard.
Give the program some time to download all the files. Once the download is finished, you will have a fresh copy of your WordPress core files while preserving all your website data.
How to re-install WordPress files using FTP
If for some reason you cannot access your WordPress dashboard, you can do the steps shown above manually using FTP. Basically, the entire process involves:
- Downloading the latest version of WordPress
- Extracting the compressed file
- Uploading all the extracted files except the wp-content folder
Now let’s discuss these steps in detail.
Downloading the latest version of WordPress
First, you have to download the latest version of WordPress. To do this, go to wordpress.org. From there, click on ‘Get WordPress’. It will direct you to the downloads page. From here you can download the latest version of WordPress.
Once the download completes, you will have a compressed file containing the latest files of WordPress. Now move on to the next step.
Extracting the compressed files
Once your download is complete, extract the compressed archive on your computer. We will be uploading the inner files and folders. But before doing that, delete the wp-content folder from the extracted folder. We are aiming to keep your files and data intact, so we will not replace the wp-content folder on your server.
Uploading all the extracted files via an FTP client
NOTE: The process shown below requires you to have an FTP account set up. You also need an FTP client like FileZilla.
Connect your host via FTP and upload the WordPress files. You need to upload the files in the root folder of where your previous WordPress files were, typically it’s in the public or public_html folder.
After you start uploading, your FTP client will prompt you with a warning message that files with the same name exist and if you would want to overwrite those. Select the overwrite option and continue.
The wp-content folder contains your themes and plugins files. Since you deleted that folder from the locally extracted directory, your site’s existing theme and plugin data will be safe. After the upload is finished, you now have a fresh re-installed version of WordPress. Hopefully, your issue will be solved after this.
How to Reinstall WordPress in cPanel
The above-mentioned method can be done through cPanel as well. Log into your cPanel and then find File Manager.
From here, locate your public_html folder (or the folder where your WordPress is installed). When in the folder, you can upload the contents of the latest WordPress version that you had downloaded earlier. That’s it. Now you know how to reinstall WordPress in cPanel.
How to reinstall WordPress core files via WP-CLI
WP-CLI stands for WordPress-Command Line Interface. This is a tool for managing various aspects of a WordPress installation. Using this command line interface you can create/remove users, posts, post-categories, insert data, and much more.
However, you have to install wp-cli on your WordPress in order to gain access to this command line interface. You can download the wp-cli files from wp-cli.org. There are full instructions along with the downloadable file itself. Once you have installed and got connected to wp-cli, open your command terminal from your computer. Now type the following command:
php wp-cli.phar -- info
Now if you see the wp-cli information, this means that your wp-cli has been successfully installed. Now you can use the command lines to interact with your WordPress website.
However, coming back to our main objective, reinstall WordPress while keeping the themes and data safe. Use the command below and WordPress core files will be downloaded and replaced your old files. It won’t affect your themes and plugins data.
wp core download --skip-content --force
Once you enter this command, it will take some time and after it’s done, your reinstallation process will be complete.
How to completely uninstall and reinstall WordPress
Note: The methods shown below will completely re-install all your WordPress core files including the wp-content folder. That means all your website data will be lost. So make sure to do a backup before proceeding with the following methods. You can use WordPress backup plugins to quickly backup your website.
In this method, we will learn how to uninstall the existing installation of WordPress and then reinstall from scratch. Basically what we will be doing is:
- Delete the current WordPress files and database
- Re-install WordPress
Delete the current WordPress files
This is pretty easy as you can just connect with your host via FTP as you did before, and delete the contents of public_html. You can also log into your cPanel and open the File Manager. Find the folder where your WordPress website is installed (typically the public_html folder) and delete all the files and folders inside.
After you have deleted all the WordPress files, your database will still be intact. You should also delete the database if you want a 100% clean installation. To remove your database, go to your cPanel and from there open up your phpMyAdmin. Select your database and then select Drop to remove your database.
If you don’t use cPanel ask your host how to access and delete your database.
Re-install the WordPress files
Once everything is deleted, you need a fresh reinstall of WordPress. There are a few ways you can do this depending on your host. You could use Softaculous or Fantastico (if your host provides these options). You can also manually install WordPress. Just download the latest version of WordPress, then setup your database then copy all the files inside
Simply, it’s just the way you originally installed the WordPress instance in question. So you know that! Once the installation is complete, you can start re-creating your website from scratch. At this point, any sort of issue should be resolved.
How to re-install WordPress themes and plugins
The methods mentioned above dealt with reinstalling WordPress core files. But in some situations, you might need to reinstall specific themes and plugins on your WordPress site. This is also an easy task, and here’s how you can do it. First, let’s see how to reinstall a WordPress theme.
You can connect your site via FTP or use any other file manager. Go to public_html > wp-content / themes or plugins. Now, to re-install the themes, rename the folder to “themes_old”.
If you want to reinstall all your plugins, then do the same process for plugins.
Once you have renamed the themes and plugins folder, you will not find these when you log into your WordPress dashboard. Now you can re-install the themes and plugins like you normally do.
👉 More for You: How to Reset WordPress – With or Without a Plugin
Conclusion
It’s important to protect your WordPress website from malware and hacking attempts. Getting your website hacked hurts your business reputation. There are several malware removal plugins and services that you can take help from to protect your website from such threats. We always recommend taking precautionary actions before it’s too late.
Sometimes re-installing the WordPress core files is necessary to get rid of bugs or corrupt files. As you have seen, re-installing WordPress is very simple. You just need to follow the right way!
Disclaimer: This post may contain affiliate links and we may receive a small commission if you purchase something by following them. However, we recommend services/products that we believe good to serve your purpose.