On occasion, WordPress, for whatever reason, may need to be reinstalled. If the user messes around with the core files, they might need to be overwritten with fresh ones. Or perhaps something else was corrupted and needs to be fixed. A lot of times it is easier to start anew than troubleshoot the problem. It gets tricky though when a portion of the installation needs to be saved, like the data in the database for example. The reason that may be tricky is if there is something in there that is the cause of the issue. At any rate, I will go through the steps below for a couple WordPress reinstall scenarios.
An Overview for a Ground Up Reinstall of a WordPress Site
If there is nothing at all that needs to be saved from the WordPress site, we could just delete all the “parts” and start over from scratch.
There are really only 2 parts to the WordPress site in general. We have the “files” which consist of the WordPress core files, the user files (uploaded using the Media Uploader for example), the plugins, and themes. Plus there may be some config files in the root, files that were created by plugins like an XML sitemap for example, or maybe even verification files like those from Google and Bing Webmaster Tools. The second part is the database and its user.
So, the first step would be to delete those two parts. Deleting the files can be done through the File Manger in the Control Panel or via FTP. Deleting the database and its user is done through the web site host’s Control Panel.
After that, everything needs to be resintalled. Get fresh files from WordPress.org. Then create a new user for the database and the database itself. Then attach the user to the database giving the user all priveleges. Make note of the database user name and password, the name of the database itself, and the server for the database. Those values will need to be put in the wp-config.php file during installation.
So the steps would be:
1. Delete the WordPress files, database user and database.
2. Get new fresh WordPress files from WordPress.org, and recreate the database and user.
3. Reinstall WordPress.
Be sure to consider security when installing WordPress. Changing the table prefix (in the wp-config file) and using something other than “admin” for the main WordPress user account is a good start.
Plus, test the site for each new addition. What I mean is, when adding the theme, test to make sure everything is good before beginning to add plugins. Then just add one plugin at a time, go through the configuration steps and then be sure it hasn’t caused any problems on the site. Then get to blogging!
Keeping the Database and Reinstalling the Rest of WordPress
It might just be that the files need to be refreshed, and the data in the database needs to stay. Consider though that if you have uploaded files using the Media Uploader that there may be references to the path for those files in past posts and pages. If that is a possibility, it might be best to keep those files as well. You will find them in the “/wp-content/uploads/” folder. Take all files and folders in there as is and re-upload to the same spot after. Maybe scan them for viruses, malware, etc. with an up-to-date scanner first.
The rest, like plugins and themes, can mostly be re-uploaded with fresh versions from their source. This gives you the opportunity to clean house and only re-upload what is necessary. But there may be some files in the root of the site that you want to keep. Examples include: Bing and Google authorization files. Those may have been added to verify ownership of the web site in the search engine’s respective Webmaster Tools. Sitemaps can be recreated but there might be other files that need to be backed up.
Be sure to keep the wp-config file. Use a fresh one because depending on the version of WordPress you were using previous (or at the beginning) there might be different code in there. But it will contain the information about the database (including server, user, password, name, table prefix) that will have to be added for the new WordPress installation.
Now, after backing up the necessary stuff, follow these steps:
1. Delete all files (after a backup of the optional files).
2. Get new fresh WordPress files from WordPress.org.
3. Upload the WordPress files and modify the wp-config file manually using the database information from the previous wp-config file.
4. Optionally upload the user files. You know, the “/wp-content/uploads/” folder.
5. Optionally add back in the files from the root.
Now, one by one, add the theme and plugins and test after each addition.