WordPress Pharma Hack Removal: How to Identify and Clean It

The pharma hack injects viagra, cialis, casino, or other spam content into your WordPress site — visible to Google’s crawler but hidden from you. Here’s how it works and how we remove it.


How to know if your WordPress site has the pharma hack

  • Search your own domain in Google with terms like site:yourdomain.com viagra or site:yourdomain.com cialis. If pages show up, you’re infected.
  • Your search result snippets show spam content when you search for your normal pages — pharma keywords appearing in titles or descriptions.
  • Google Search Console flags pages with unusual queries — pharma, gambling, or other unrelated keywords driving traffic.
  • You see the infection only when viewing as Google — pharma hacks routinely use cloaking, so visiting your site in a browser looks normal while Googlebot sees spam.

Why the pharma hack is hard to remove

Pharma hacks are designed for persistence. The typical infection includes:

  • A backdoor PHP file disguised as a legitimate WordPress file
  • Database injections that store spam content in wp_posts, wp_options, or custom tables
  • A cloaking layer that detects Googlebot and serves spam content only to crawlers
  • A scheduled re-injection task in wp_cron that restores the infection if you delete it
  • Modified .htaccess rules redirecting specific URLs or user agents

Deleting one piece without finding the others = the infection comes back in days.

How we remove it

  1. Full external scan with cloaking detection (we crawl your site as Googlebot to see what attackers see)
  2. Full file scan and database scan — we find every injection point, not just the visible ones
  3. Backup before any change
  4. Remove all infection layers — files, database entries, .htaccess rules, and scheduled cron tasks
  5. WordPress core integrity check — verify every core file against canonical hashes
  6. Access audit — remove unknown admin accounts, rotate credentials, neutralize any scheduled persistence tasks
  7. Verify clean — re-scan as both regular visitor and Googlebot
  8. Optional: Google Search Console reindex request to flush the spam URLs from search results

Want to see what a thorough cleanup looks like? Real case study →


Free pharma hack scan

Send us your domain. We’ll tell you whether pharma spam is present, how deep the infection goes, and what it takes to fix.


30-Day Money-Back Guarantee **

We Know Trying A New Service Can Be Scary and Overwhelming. That’s Why We Offer A 30-Day Money-Back Guarantee. If You’re Not Happy With Our Service We’ll Gladly Refund You Every Penny!

Get Started

Best WordPress Partner We’ve Worked With

We couldn’t keep up with the daily upkeep of our website and SecurItPress was recommended by a fellow small business owner. They took over the maintenance and hosting of our site! Couldn’t be happier and a bonus was the site loaded faster than it ever had.
Sophia Bailey
Mad Mini’s

** Money-Back Guarantee is only available for our Annual Site Care Plans, not Monthly plans or Site Cleanup service.