How to Reinstall WordPress

How to reinstall WordPress - CodeFlist

Recently, we got a mail where one of our users asked how to reinstall WordPress? While using WordPress, sometimes you may face issues due to corrupt files. To solve this problem, you need to reinstall the WordPress file making sure that the existing files are not lost. On the other hand, if you want to start from the beginning, you can reinstall the fresh copy of WordPress.

Depending on your requirement, you may either want to reinstall and start a new site or only want to reinstall core WordPress files to prevent losing the site content. You should always remember to take a backup of the site before you reinstall WordPress so that it will be useful in case if you need to restore the site to the earlier state.

Reasons to Reinstall WordPress

There may be different reasons for you to make a decision to reinstall WordPress.

  1. Due to the major error. WordPress files may be corrupt and it may not get solved by minor code editing, in such a case you may need to do it.
  2. Developers need to reinstall WordPress multiple times to test themes or plugins. They need to test whether the current version of their product is compatible with the WordPress version or not.
  3. In case of a hack, you need to rebuild the site. It may or may not be possible to recover your content but you have to recover your site quickly.

How to reinstall WordPress

There are different methods to reinstall WordPress. Let’s have a look at them one by one.

How to reinstall WordPress
How to reinstall WordPress

Reinstall WordPress from Admin Dashboard

This is the recommended method to reinstall WordPress if you have access to the admin dashboard. If you use this method, then all your site contents will not be lost.

When you are in the dashboard, Go to Dashboard > Updates and you will find the option to reinstall.

After you click Re-install, then you need to wait for some time as it will be working for the changes. During this period, the site will be unavailable shortly. This is an automatic process so there is nothing to worry about.

However, if you do not have access to the dashboard, you can also do it manually from other methods listed below.

Reinstall WordPress using WP-CLI

WP-CLI can be used to add or remove different categories, posts as well as users. In addition, you can insert or replace test data and search from the database. CLI is the tool that can be used to add the commands in order to customize the WordPress installation. This is supported by major WordPress hosting companies and you can use it to reinstall WordPress without changing the current state of themes and plugins.

wp core download --skip-content --force

Reinstall WordPress using FTP

This method is recommended if you do not have access to the admin dashboard. This is a manual method to reinstall WordPress. If you are familiar with FTP, you can access the site contents through it.

First of all, you need to download the latest version of WordPress from wordpress.org. You need to extract the contents from the zip version of WordPress. Delete the wp-content folder after extraction.

Why do you need to delete the wp-content folder?

It is done to prevent overwriting the content.

With FTP credentials, you can upload the remaining files to the WordPress installation directory. Usually, the root folder will be named as public or public_html in most of the hosting providers. While uploading, you will need to replace the existing files that are present in that location.

This process replaces core files with a fresh copy of WordPress. As we have previously deleted the wp-content folder, the content related files like themes and plugins remain the same.

How to reinstall WordPress completely (Delete all files)

If you no longer want to save existing files like themes, plugins, and other contents present in your site, this method is recommended to you. You will not be able to recover the site once you delete all the content.

To continue with this process, you need to perform two steps:

  1. Delete all WordPress files
  2. Install a new copy of WordPress

If you have access to the admin dashboard, you can delete the files from the WordPress dashboard. However, you may also use FTP in case if you do not have access to the dashboard.

You can further delete the database from the phpMyAdmin if you want a completely new start. Deleting the database will remove each and every data associated with your site.        

Likewise, you can install the latest version of WordPress in the root directory.

Conclusion

If you followed the things mentioned in this post, then you already know how to reinstall WordPress. It’s an easy process that can be done automatically from the dashboard or manually with the help of FTP, WP-CLI, etc.

Furthermore, you can delete the database in the process of removing the site if you want a fresh new start. 

Hopefully, this post was useful to describe the topic. If you have any confusion, feel free to leave the comment below.

Further Reading

  1. How to Hide Page Title in WordPress
  2. How to Embed Video in WordPress
  3. How to Edit HTML in WordPress