Completely reinstall WordPress (also without data loss)

In most cases, WordPress is installed once when a website is launched and from then on it is kept up to date using the update function. However, there may also be situations where you want to completely reset and reinstall your WordPress installation. Here you can find out how to set up WordPress from scratch and even import your old content if necessary.

Reasons to reinstall

Normally, WordPress is set up and set up once at the start of a web project. From this point on, the content is created and the WordPress system is only supplied with updates. At most, a new plugin is installed or deleted once. But there are also reasons for a complete reinstallation of WordPress on an existing website:

  • page realignment
  • Broken configuration
  • Hacker Attack

It can happen that you start a web project with a certain content orientation, but then realize after a while that you would rather go in a different direction. In many cases, the WordPress site should then be completely restarted with a different theme and different content.

If you have tried many different plugins, entries often remain in the database even after deactivation. Even if you make many manual changes to configuration files, errors can creep in over time or with future updates. A new installation can be the method of choice here.

A clean install should be the last resort

In many cases, a reinstallation of WordPress is not necessary at all at second glance. Especially when realigning a project, you should check whether you can adapt the existing WordPress installation accordingly. Many configuration errors can also be corrected without a new installation.

If your own WordPress site is infected via a security hole, malicious code could have been smuggled into individual files on the server or into the database. If there is no longer a backup from before the attack, a reinstallation is usually the only way back to a clean website.

Reinstall WordPress

Below you will find all the necessary steps to back up the contents of your existing WordPress installation and then delete and reinstall WordPress.

Important: These instructions only apply to simple WordPress sites. There can be no general procedure for extensive pages with infrastructure plugins, child themes, custom styles and other adjustments.

1. Create backup

Even if we back up all content from WordPress in the following steps, I recommend creating a backup of the current status quo. This can be done with just a few mouse clicks with the Duplicator plugin. You should then download the created backup in the form of a zip archive to your computer. In an emergency, you have a way of restoring the previous status.

2. Export data

WordPress comes with an export function for the created content. You can find this in the backend under Tools > Export Data. With this export function, all posts, pages, comments, categories, tags and menus can be downloaded in a special XML format.

In the case of an infected WordPress site, you should check the XML file for malicious code with a virus scanner. For example, if you have previously found links to strange domains in your posts, you should open the XML file with a text editor. Then you can search for those links and remove them.

3. Save uploads

The previously created export file does not contain the images and downloads uploaded via the media library in the WordPress directory /wp-content/uploads/. To secure this, you should log into your web space via FTP and download the directory to your computer.

In the case of an infected WordPress site, you should definitely check this directory with a virus scanner. This way you can rule out that none of the files were infected with malicious code. Also, only the files you have uploaded should be in the directory. .php files that can be executed by the server normally have no place in the directory.

4. Save theme and plugin settings

If you want the website to appear with the same look & feel after the reinstallation, you must note which theme and which plugins you are currently using. Theme and plugin settings must also be backed up.

Many premium themes like Divi or extensive plugins like Yoast SEO offer an export function to save the settings. This is not possible with simple themes and plugins, here you have to make a note of the settings you have made or simply create screenshots of them.

5. Delete WordPress

After you have exported and backed up all data, you can now delete the existing WordPress installation. Important: If you perform this step, your website will no longer be accessible. If visitors then come to your site via links or search engines, they will see an error message.

If you want to proceed with the deletion, log in to your web space and delete all files in the root of your domain. In order to start with an empty database after the new installation, you must also empty or delete the existing database and create a new one. You can do this in the customer menu of your web host.

6. Reinstall WordPress

Now you can reinstall WordPress on your web space. The individual steps are identical to the first WordPress installation.

Then install the theme you want and the plugins you need. After that you can import the corresponding settings or make them manually as you have previously noted them down or captured them as screenshots.

7. Import data

You can now import back the posts, pages, comments, categories, tags, and menus you exported at the beginning. You can find the import function in the backend under Tools > Import Data. The importer must then be installed by clicking on the link.

The XML file is a text file that you can open and edit in any editor. For example, you could remove certain posts so that they are not imported again.

8. Check URL structure

After reinstalling WordPress and importing your posts and pages, you should check the URL structure. The permalink settings should be the same as before the reinstall. Otherwise, existing links to your posts would come to nothing. If you want to consciously change the URL structure, you should forward the old URLs to the new version.

Reset WordPress via plugin

If you only want to reset the database, you can also use the WordPress plugin WP Reset. This allows the database to be reset to its original state after installation. However, no files on the web server are removed.

Conclusion

You can use the above steps to delete WordPress and then reinstall it. If all settings and content have been exported and backed up beforehand, a new installation is even possible without data loss. However, you should first consider whether a complete reinstallation is really necessary in your case.