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.
Day 0
An outdated plugin is exploited and spam code is added to a theme file.
Day 3
Googlebot crawls the pages and sees hidden pharma links. You see nothing.
Week 2
Rankings slip and spam titles appear when you search your brand.
Week 4
Google Search Console shows a security or manual action warning.
After cleanup
You remove the code, close the hole and request a review.
How to check if your site has it
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.
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.
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.
Fetch the page with a crawler user agent
Run the curl command below and search the output for spam words or unexpected outbound links.
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.
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"- Vulnerable plugin or weak loginAttacker gets in
- Spam code injectedHidden links and pages added
- Google crawls spamPages flagged or demoted
- Visitors see warningsTraffic and trust drop
- Leads and salesFewer enquiries and orders
The break is the injection itself. Everything after it carries the spam.
How to fix it
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.
Change all credentials
Reset passwords for admin users, hosting, FTP/SFTP, database and email. Remove unknown users and revoke old API keys.
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.
Check the database
Look for spam in posts, widgets, options and injected scripts. Remove unknown admin accounts and scheduled tasks you did not create.
Update and remove risky software
Update the CMS, themes and plugins. Delete anything unused or abandoned, and never use nulled themes or plugins.
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.
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.
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.
Replace plugins and themes
Delete and reinstall each from the official source. Check Users for unknown administrators and the uploads folder for .php files.
Regenerate secrets
Replace the salts in wp-config.php so existing logins are invalidated.
Check theme code
In Online Store > Themes > Edit code, search theme.liquid and other files for unknown scripts or links. Publish a clean earlier theme version if needed.
Review apps and staff
Remove unknown apps and staff accounts, and reset the store owner password. Turn on two-step sign-in.
Audit containers
Look for Custom HTML tags you did not create that inject links or load unknown scripts. Check Admin > User Management for unknown users.
Publish a clean version
Revert to a known-good version or delete the rogue tags, then publish.
Check custom code
Review Site settings > Custom code and page-level custom code, plus embeds, for unknown scripts or links.
Review access
Remove unknown workspace members, reset passwords and republish.
Check tracking and custom code
Review the custom code areas in funnel and website settings and individual pages for unknown scripts or links.
Review users
Remove unknown team members and reset passwords.
Check custom code and collaborators
Review Settings > Custom Code and your site's contributors. Remove anything unknown and change your password.
Check code injection
Review Settings > Advanced > Code Injection and any code blocks. Remove unknown code, remove unknown contributors and change your password.
Compare with version control
If you use Git, run git status and git diff against a clean commit to spot altered files. Otherwise compare to a known-good backup.
Search for suspicious functions
Use the command in the next block, then inspect each hit.
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"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
- 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
- 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.
Related issues
- SEO-192Hidden spam pages created by malware (Japanese keyword hack)Fix guide
- SEO-190User-generated spam in comments or forumsFix guide
- SEO-182Lorem ipsum or placeholder content liveFix guide
- SEO-188Expired event, offer or job pages left liveFix guide
- SEO-175Thin content on money pagesFix guide
- SEO-176Duplicate content copied across pages (city pages, product variants)Fix guide