How to Remove Malware From a WordPress Site
A safe order for removing malware from WordPress: snapshot, rotate credentials, replace core and plugins from clean sources, then ask Google to review.
Short answer: do not start by deleting suspicious files. Removing malware from WordPress safely follows a fixed order: take a snapshot of the infected site, change every password and secret key, replace WordPress core, themes and plugins with fresh copies from their original sources, hunt down what is left in the uploads folder and the database, close the hole the attacker used, and then ask Google to review the site. If you skip the credential and entry-point steps, the same attacker is usually back within days.
Before you start
- Snapshot first. Download the files and a database export as they are now. You need them to work out how the attacker got in, and if your clean-up breaks something.
- Use a clean computer. If an admin's PC is infected, every new password you type on it is already stolen.
- Put up a maintenance page if visitors are being redirected or warned. That protects customers while you work.
Step 1: Rotate every credential
Change all of these, not only the WordPress admin password:
- Every WordPress administrator password, after deleting any admin users you cannot account for.
- Hosting panel (cPanel or Plesk), SFTP/FTP and SSH passwords.
- The database user's password, then update
DB_PASSWORDinwp-config.php. - The secret keys and salts in
wp-config.php. Generate a new set from WordPress.org's key generator. This logs out every session, including the attacker's. - Email accounts on the domain, if the server was used to send spam.
- API keys stored in plugins: payment gateways, SMTP services and similar.
Step 2: Replace core, themes and plugins with clean copies
Do not "clean" core files by hand. Replace them:
- WordPress core: download the same version from WordPress.org and replace
wp-admin/andwp-includes/completely, plus the root PHP files exceptwp-config.php. - Plugins and themes: delete each folder and reinstall it from WordPress.org or the vendor. Remove anything you do not use, and anything that came from a "nulled" (pirated) source. Nulled plugins are a well-known way malware gets in.
- Your own theme or child theme: compare it with a known-good copy from your developer or your Git history.
WordPress's own guidance for hacked sites follows the same principle: restore from known-good sources rather than editing infected files (WordPress.org FAQ).
Step 3: Hunt what is left
What survives a core and plugin reinstall usually sits in these places:
wp-content/uploads/: there should be no.phpfiles here. Any you find are almost certainly backdoors.wp-config.phpand.htaccess: look foreval(,base64_decode(, long encoded strings, or rewrite rules that send visitors from search engines or mobile devices somewhere else.- The database: search
wp_optionsandwp_postsfor<script,eval(or unfamiliar domains, and check thesiteurlandhomevalues. - Scheduled tasks: the hosting panel's cron jobs, and WordPress cron events that call unknown URLs.
- Other sites on the same hosting account. One infected old site in a subfolder will reinfect the main one.
Step 4: Close the way in
Typical entry points are an outdated plugin with a known vulnerability, a reused or leaked password, a nulled theme, or an abandoned site on the same account. Check the plugin versions in your snapshot against the current releases. Then apply the basics in WordPress's hardening guide and in our WordPress hardening checklist: least-privilege accounts, two-factor login, no file editing from wp-admin, and timely updates.
Step 5: Ask Google to review
If Google flagged the site, fix it first, then use Request review in Search Console's Security issues report. Say what you found and what you fixed. Also check for, and remove, any Search Console owners you do not recognise. Google's clean-up guide includes that step (web.dev). For red browser warnings, see removing "Deceptive site ahead".
Step 6: Report and record
You can report the incident to MyCERT through Cyber999 by online form, by email to cyber999@cybersecurity.my, or on 1-300-88-2999 during office hours. If customer personal data may have been accessed, check the PDPA's 72-hour notification rule as well. Write down what you found, when, and what you changed. Your insurer, your customers or the Commissioner may ask.
When to hand it over
Do it yourself if you have SFTP, database access and a clean afternoon. Hand it over if the site takes payments, holds customer data, is being reinfected, or Google has already flagged it. JagaWeb's Emergency Recovery is quoted per incident and covers containment, malware removal, credential rotation and a written report. See hacked website repair. After clean-up, WordPress care from RM249 a month keeps the site patched and monitored.
Not sure whether you are infected? Start with the free website check, and read the nine signs of a hacked website. All plans and fixed prices are on the pricing page.
FAQ
Is a malware-scanner plugin enough? It can find known patterns, but it cannot tell you how the attacker got in, and an attacker with admin access can switch it off. Reinstalling from clean sources and rotating credentials matter more.
Should I just restore last month's backup? Only if you know the infection started after that backup, and only after you have rotated credentials and patched the way in. Otherwise you restore the vulnerability along with the content.
How long does Google take to remove the warning? Google reviews the site after you request it in Search Console. Timing varies, so ask only after the site is actually clean.
Ready to verify who owns your website?
Replace uncertainty with a decision-ready ownership and access report. The fixed Ownership & Access Review is RM1,500 before SST and includes a 30-day action plan.