Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Hacked content injected (pharma, casino links): find and fix

SEO-191High impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

Injected content is text, links or whole pages that someone else put on your website without your permission. The usual topics are pharmacy products, online casinos, loans and counterfeit goods. The goal is to borrow your site's reputation to lift the attacker's own sites in search.

It is often hard to see. Attackers hide links with CSS, place them in the footer or in old posts, or use cloaking: the page shows spam only when the visitor looks like Googlebot, and shows normal content to you.

Typical entry points are outdated plugins and themes, weak or reused admin passwords, nulled (pirated) themes, and compromised hosting or FTP accounts.

Why it costs you leads or sales

Google can label your pages as hacked, show a warning in results, or apply a manual action for spam. Browsers may display a red warning page. Visitors who see either one rarely come back. Your real pages can also drop in rankings because they now carry spam links and unrelated keywords.

Search results may show spam titles and snippets under your brand name, which damages trust before anyone reaches your site. Email from your domain can also be blocked if the same hack is used to send spam.

How an injection typically unfolds (Example)
  1. Day 0

    An outdated plugin is exploited and spam code is added to a theme file.

  2. Day 3

    Googlebot crawls the pages and sees hidden pharma links. You see nothing.

  3. Week 2

    Rankings slip and spam titles appear when you search your brand.

  4. Week 4

    Google Search Console shows a security or manual action warning.

  5. After cleanup

    You remove the code, close the hole and request a review.

How to check if your site has it

Check for injected content
  1. Check Google Search Console

    Open Security & Manual Actions and read both reports. Also review Pages and Performance for URLs or queries you do not recognise, such as drug names or casino terms.

  2. Search Google for spam on your domain

    Search site:yourdomain.com viagra, then repeat with casino, payday loan, replica and cheap. Any hit on a page you did not write is a warning sign.

  3. View the page as Googlebot

    In Search Console use URL Inspection, then View crawled page, and compare the HTML with what you see in your browser. Differences point to cloaking.

  4. Fetch the page with a crawler user agent

    Run the curl command below and search the output for spam words or unexpected outbound links.

  5. Review files and users

    Look for recently changed files, unknown admin users, unfamiliar plugins and odd code such as eval, base64_decode or long encoded strings in theme files.

Compare what Googlebot-like requests receivebash
curl -s -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" https://www.example.com/ | grep -iE "viagra|cialis|casino|poker|payday|replica"

curl -s https://www.example.com/ | grep -iE "viagra|cialis|casino|poker|payday|replica"
Where the damage spreads
  1. Vulnerable plugin or weak loginAttacker gets in
  2. Spam code injectedHidden links and pages added
  3. Google crawls spamPages flagged or demoted
  4. Visitors see warningsTraffic and trust drop
  5. Leads and salesFewer enquiries and orders

The break is the injection itself. Everything after it carries the spam.

How to fix it

Clean the site and close the hole
  1. Put the site in a safe state

    Consider maintenance mode while you clean. Ask your host whether they can isolate the account or provide a malware scan.

  2. Change all credentials

    Reset passwords for admin users, hosting, FTP/SFTP, database and email. Remove unknown users and revoke old API keys.

  3. Restore or remove the injected code

    Best option: restore a backup from before the hack, then update everything. Otherwise replace core, theme and plugin files with fresh copies from the official source and delete unknown files and spam pages.

  4. Check the database

    Look for spam in posts, widgets, options and injected scripts. Remove unknown admin accounts and scheduled tasks you did not create.

  5. Update and remove risky software

    Update the CMS, themes and plugins. Delete anything unused or abandoned, and never use nulled themes or plugins.

  6. Check for backdoors

    Attackers often leave hidden files that let them return. Review .htaccess, wp-config.php, the uploads folder (which should not hold PHP files) and recently modified files.

  7. Request a review

    If Search Console shows a security issue or manual action, fix everything, then use Request Review and explain what you cleaned and how you closed the hole.

Platform specifics
  1. Reinstall core files

    In Dashboard > Updates choose Re-install version, or run wp core download --force --skip-content with WP-CLI. Then run wp core verify-checksums to list altered core files.

  2. Replace plugins and themes

    Delete and reinstall each from the official source. Check Users for unknown administrators and the uploads folder for .php files.

  3. Regenerate secrets

    Replace the salts in wp-config.php so existing logins are invalidated.

Search a server for common malware patternsbash
grep -rIl --include=*.php -E "eval\(base64_decode|gzinflate\(base64|str_rot13\(|preg_replace\(.*/e" /var/www/html

find /var/www/html/wp-content/uploads -name "*.php"
Before and after cleanup

Hacked

  • Hidden pharma and casino links in the footer
  • Spam pages indexed under your domain
  • Unknown admin user and backdoor file
  • Security warning in Search Console

Clean

  • Only your own links and content
  • Spam URLs removed and returning 404 or 410
  • Passwords changed, software updated
  • Review requested and issue cleared

How to confirm it's fixed

Confirm the cleanup
  • The curl check with and without a Googlebot user agent shows no spam words
  • URL Inspection in Search Console shows a clean crawled page
  • site: searches for spam words return nothing new
  • Spam URLs return 404 or 410 and are removed from Google using the Removals tool if needed
  • No unknown admin users, plugins or PHP files in uploads
  • A malware scan from your host or a security plugin is clean
  • Security and Manual Actions reports show no issues, or your review is approved

How to prevent it happening again

Hardening checklist
  • Turn on automatic updates for the CMS, themes and plugins where safe
  • Remove unused plugins, themes and users
  • Use unique strong passwords and two-factor sign-in for admins and hosting
  • Use SFTP, not plain FTP, and limit who has file access
  • Keep off-site backups and test a restore
  • Add Search Console users with email alerts turned on, and verify every version of your domain
  • Run scheduled malware scans and file-change monitoring through your host or a security tool
  • Never install nulled themes or plugins

How FunnelGuard handles this

FunnelGuard does not check for injected spam content yet. It is a possible future check. It is not a malware scanner and will not tell you that hidden pharma or casino links exist on your pages.

What FunnelGuard does cover nearby: a robot visitor runs your real journeys, such as lead forms and checkouts, on a schedule. It checks each step, the tracking hits sent to platforms like GA4, Google Ads and Meta, and whether test leads reach your inbox and CRM. If a hack breaks a form, redirects a page or stops a tag from firing, that failure can show up as a failed journey step, but the alert would not name hacked content as the cause.

Frequently asked questions

Questions people ask

Why are there pharma or casino links on my website that I did not add?

Most likely an attacker got in through an outdated plugin or theme, a weak password or a compromised hosting account and injected the links. They are often hidden with CSS or shown only to search engines. Treat it as a hack: back up, find the entry point, clean the code and change all passwords.

How do I find hidden spam links on my website?

Search Google for site:yourdomain.com with words like viagra or casino, check Search Console's Security & Manual Actions reports, and use URL Inspection to view the page Googlebot sees. Also search theme and plugin files for suspicious code such as eval(base64_decode and compare files with a clean backup.

Why does my site look normal but Google shows spam in results?

The site may be cloaking, meaning it serves spam only to search engine crawlers or visitors arriving from Google. Use URL Inspection in Search Console to see the crawled version, and check your sitemap and indexed URLs for pages you did not create.

How do I remove injected spam links from WordPress?

Back up first, then restore a clean backup or reinstall core, theme and plugin files from official sources. Delete unknown files, users and spam posts, check the database and uploads folder for backdoors, update everything and change all passwords and salts.

Will hacked content hurt my Google rankings?

Yes, it can. Google may show a hacked warning, apply a manual action for spam, or demote pages that carry spam links. Rankings usually recover after you clean the site and, where a warning exists, request a review.

How do I ask Google to review my site after a hack?

Fix the issue fully first. Then open Security Issues or Manual Actions in Search Console and choose Request Review, describing what was wrong and what you did to clean it and prevent a repeat. Google reviews can take from a few days to a couple of weeks.

Can FunnelGuard detect hacked content or malware on my site?

No. FunnelGuard does not check for injected content yet, though it is a possible future check. It monitors your funnels, tracking hits and lead delivery, so use Search Console and a malware scanner to watch for hacked content.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.