WordPress Malware Removal
Full incident handling for hacked sites: containment, investigation, cleanup, verification and a written report of what was found.
Explore this service →Deleting the infected files is the easy part. The work that decides whether your site stays clean is finding how the attacker got in, removing every persistence mechanism they left behind, and closing the path before you put the site back in front of customers.
The instinct when you find malicious code is to delete it immediately. Resist that for an hour. The moment you start deleting, you destroy the evidence that tells you how the attacker got in, what else they touched, and whether they still have access. A cleanup that skips this step is a cleanup you will repeat.
Three things happen first. Take a full copy of the site as it currently is, infected, including the database, and store it somewhere the live site cannot reach. Note the timestamps of every suspicious file you have already found. Then pull whatever access logs your host retains, because the request that dropped the first payload is usually still in them.
If the site is actively serving malware to visitors, redirecting traffic, or sending spam, containment comes before investigation. Putting the site into maintenance mode, disabling outbound mail, or placing it behind an access rule stops the ongoing damage while you work. On a site handling payments, containment is not optional.
If an attacker had file write access, treat every credential reachable from that server as compromised: WordPress administrator accounts, database user, FTP and SFTP, hosting panel, and any API keys sitting in wp-config.php or a plugin settings table. Rotating these later, after the cleanup, is a common reason sites get reinfected during the cleanup itself.
A WordPress infection almost always spans the filesystem and the database. Cleaning one and declaring victory is the single most common failure in do-it-yourself recovery.
Replace WordPress core wholesale with a fresh copy of the same version rather than trying to clean individual core files. Do the same for every plugin and theme that is still available from a trusted source. This is faster and more reliable than diffing thousands of files, and it removes injected code you have not spotted yet.
What cannot be replaced wholesale is the uploads directory, wp-config.php, .htaccess, and any custom or abandoned plugin with no clean source. These get reviewed by hand. Executable files inside wp-content/uploads are a strong signal on their own, because nothing legitimate puts PHP there.
Check the options table for injected script tags and unexpected autoloaded rows, the users table for administrator accounts you do not recognise, the posts and postmeta tables for hidden spam blocks, and any table holding theme or widget content. On a multisite install, repeat per site. Pharma hacks and SEO spam injections live here far more often than in files, which is exactly why file-only scans keep reporting a clean site that is still serving spam to Google.
An attacker who has been on a site for more than a few hours has usually left more than one way back in. Persistence is the reason a site gets reinfected within a week of a cleanup that looked complete.
The mechanisms worth checking every time:
wp-content/mu-plugins, which load automatically and never appear in the plugin list..htaccess rules that conditionally redirect based on user agent or referrer, so the site looks fine to you and redirects the visitor arriving from Google.functions.php and header or footer templates.Use the timestamp of the earliest known malicious file as your anchor, then look at everything modified in the same window. Attackers frequently reset timestamps on the obvious payload and forget the helper file they wrote three minutes earlier.
Cleanup without root cause is temporary. In practice the entry point is almost always one of a short list: a known vulnerability in an outdated plugin or theme, a weak or reused administrator password, a compromised hosting or FTP account, a nulled premium plugin carrying a backdoor from the day it was installed, or a neighbouring site on the same shared hosting account.
Access logs settle it faster than guesswork. Look for POST requests to unusual paths around the first malicious file timestamp, requests to files that should not accept POST at all, and successful logins from addresses that do not match your team. If the entry point genuinely cannot be determined from available evidence, say so, and compensate by hardening every plausible path rather than pretending you found it.
This is also where a security hardening pass stops being optional. Cleanup removes the current infection. Hardening is what changes the outcome next time.
Verification is a separate step with its own checklist, not a feeling that you got everything.
site: search for indexed spam URLs that need removal.Full detail on the detection side of this is in the WordPress malware scanning guide.
The window immediately after a cleanup is the best time to fix the things that made the site an easy target. Update everything to current versions. Remove plugins and themes that are deactivated but still installed, because inactive code is still reachable code. Enforce strong unique passwords and two factor authentication on every administrator account. Apply least privilege so contributors are not administrators. Disable file editing in the dashboard. Confirm backups actually run and that you have tested a restore.
A short written record of what was found, what was removed, what the entry point was and what changed afterwards is worth more than it sounds. It is what lets you answer the client or the payment processor, and it is what makes the next review faster.
With the site clean and hardened, edge controls reduce how much hostile traffic reaches the application at all. Rate limiting on wp-login.php and xmlrpc.php, WAF rules matched to your real endpoints, and bot controls tuned to your traffic all cut the volume of automated attempts significantly. Start with the Cloudflare WAF setup guide and the bot protection guide. Edge protection does not replace application security, it just means far fewer attempts get to try.
Handle it yourself when the infection is recent, the entry point is obvious, you have a clean backup and the site is not handling payments or sensitive data. Bring in a specialist when any of the following are true:
The cost of a second failed cleanup is usually higher than doing the first one properly, because by then the site has also lost rankings and, on an ecommerce store, orders.
If the site is live and infected, the sequence below matters more than the tooling. These are the engagements that cover it end to end.
Full incident handling for hacked sites: containment, investigation, cleanup, verification and a written report of what was found.
Explore this service →Close the access paths that allowed the compromise so the cleanup holds. Accounts, file permissions, configuration and plugin exposure.
Explore this service →Ongoing monitoring, updates and response for businesses that do not want to notice the next infection from a customer email.
Explore this service →A straightforward single-site infection with clean backups is usually resolved within a day. Sites with no backups, multiple infected installs on one hosting account, or a compromise that has been running for months take longer, because the investigation has to establish how far the attacker moved before anything is deleted.
Only if you know the backup predates the compromise and the original entry point has been closed. Restoring to a point where the vulnerable plugin is still installed usually results in reinfection within days. A restore is a recovery step, not a security fix.
Plugin scanners are good at flagging known malicious signatures in files. They are much weaker at database injections, malicious administrator accounts, cron-based persistence and modified core files that still pass a checksum. They are a detection aid, not a cleanup process.
A pharma hack injects hidden spam content, usually pharmaceutical keywords, that is served only to search engine crawlers. It recurs because the payload is typically stored in the database or a cron job rather than in an obvious file, so a file-only cleanup misses it entirely. See the section on persistence above.
If Search Console shows a security issue or the site was flagged by Safe Browsing, request a review once the cleanup is verified. Requesting a review while the payload is still present usually results in a second, longer flag.
Yes. Some steps, including account level scans, server side log retrieval and shared hosting isolation, are faster through the host. Coordination usually shortens the investigation rather than complicating it.
Use this guide alongside the relevant commercial service: security services, WordPress security, Cloudflare security, and click fraud prevention.
Talk directly with Xequent about WordPress security, Cloudflare protection or click-fraud controls.
Xequent is operated by Rana Shahwaiz Aslam. The current professional profile shows 100% Job Success, Top Rated Plus, 37 jobs, and 851 hours on Upwork, with pricing scoped to the engagement rather than an open-ended hourly meter. Rana's profile title identifies him as CEH Certified and focused on managed Cloudflare security and cybersecurity.