---
title: How to Clean Up a WordPress Website
description: "Wordpress is the most popular Content Management System in the world, with over 33% of websites running on Wordpress. Unfortunately, popular software also attract a lot of malicious actors who will attempt to compromise your website for different gains. Some…"
url: "https://truehost.com/support/knowledge-base/how-to-clean-up-a-wordpress-website/"
updated: "2024-06-21"
category: WordPress
---

# How to Clean Up a WordPress Website

Wordpress is the most popular Content Management System in the world, with over 33% of websites running on Wordpress. Unfortunately, popular software also attract a lot of malicious actors who will attempt to compromise your website for different gains.

Some of the tactics used are:

- Deploying cracked themes/plugins online. Only the malicious actors know what they have done to a theme they crack. Once you download and use these themes, you end up allowing access to your website
- Trying to gain access to wordpress websites that have weak login credentials
- Exploiting known vulnerabilities on themes/plugins and your server. At Truehost, we keep up to date with emerging trends and employ many security layers, some which are premium to prevent server vulnerability

If your site should get compromised, please use this steps to clean it up

1.Backup the website.

2.Remove all files except wp-config.php and wp-content folder

3.Download Wordpress from **wordpress.org** and upload

4.Update wordpress, themes and plugins from the dashboard.

Below, we describe the process in detail

## 1.Backup the website

You can use [this guide to backup your wordpress site](https://truehost.com/support/knowledge-base/how-to-backup-a-wordpress-site-in-cpanel/)

## 2.Remove all files except **wp-config.php** and **wp-content** folder

a.Login to cPanel and go to **File Manager**

![](http://truehost.com/support/wp-content/uploads/2022/10/Screenshot-2022-10-20-at-15-40-51-cPanel-Tools.png)

b.Navigate to the folder that has your wordpress installation. Mine is called wp.rawle-engineering.xyz

c.Remove all files except **wp-content** and **wp-config.php**. See video below.

NOTE: Its important to retain **wp-content** folder as your themes, uploaded files and plugins are stored here. The **wp-config.php** file contains your database access details hence needs to be maintained.

## 3.Next download wordpress from https://wordpress.org/download/

a.Upload the wordpress file into cPanel and extract the file

![](https://truehost.com/support/wp-content/uploads/2022/10/Screenshot-from-2022-10-21-08-37-24-1024x434.png)

b.A folder called **wordpress** will be created. Access this folder and remove the **wp-content** folder there. Then move all files remaining to your initial wordpress folder. See video below

c.Lastly create a file called **.htaccess** and add the content below into it

```
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
```

## 4.Update wordpress, themes and plugins from the dashboard.

Finally, update the wordpress installation, themes and plugins. Use this guide

> [How To Update Your WordPress Installation](https://truehost.com/support/knowledge-base/how-to-update-your-wordpress-installation/)

[“How To Update Your WordPress Installation” — ](https://truehost.com/support/knowledge-base/how-to-update-your-wordpress-installation/embed/#?secret=2N8OeFEGf2#?secret=Z2Z8MXfMZP)

## Additional guides

Below is an advanced guide from wordfence.com on how to clean up a wordpress guide.

https://www.wordfence.com/docs/how-to-clean-a-hacked-wordpress-site-using-wordfence
