Website Security
WordPress Spam Links Injected (WordPress Repair)
Last reviewed
Direct answer
Injected spam links on a WordPress site are unauthorized outbound links or hidden text that someone planted in your files or database to borrow your search reputation; remove them by preserving a copy, replacing code from trusted sources, cleaning database content and users, rotating credentials, patching the entry point, and then requesting review if Google flagged the site.
You may notice odd links in the footer, links to casinos, loans, or counterfeit goods in view-source, or spam snippets in Google while the visible page looks normal. These links are often hidden with styling or served only to crawlers. Deleting the links you can see is never enough; the code that re-creates them and the weakness behind it must be removed too.
Key facts
Verifiable numbers and definitions — each claim links to its source.
- Google’s spam policies state that hackers may add hidden links or hidden text to pages using CSS or HTML, or use cloaking, so content is visible to search engines but harder for owners to spot. (Google Search Central — spam policies)
- Search Console describes content injection as a hacker adding spammy links or text to a site’s pages. (Google Search Console Help — Security issues)
- Google says that deleting hacked pages and returning a 404 status lets them fall out of the index over time, and that using the Remove URLs tool is optional. (web.dev — Clean and maintain your site)
- Google notes that hackers often try to monetize cloaked keyword and link hacks by selling the links on hacked pages to third parties. (web.dev — Fix the cloaked keywords and links hack)
What the error means
Link injection is a cheap way for attackers to monetize someone else’s domain. After gaining access they add links or text to templates, posts, widgets, options, or plugin files, sometimes also creating whole spam pages. Search engines can see the content even when you cannot, so the damage shows up as hurt rankings, Search Console security alerts, or warnings from a host scanner. Because the links usually come from a script or a database value that regenerates them, the same link reappears after a manual edit. Rescue 404 treats link injection as a compromise: capture evidence, find every injection point in files and database, rebuild from clean sources, remove rogue users, rotate access, close the weakness, and verify as a crawler and as a logged-out visitor. This guide is defensive only and does not cover how injections are crafted.
Common symptoms
- View-source on your pages shows outbound links or text you did not add, even though they are not visible on screen
- Footer, sidebar, or post content contains links to unrelated casino, loan, adult, or counterfeit sites
- Google snippets or titles for your pages include spam keywords
- Search Console Security issues lists content injection, code injection, or hacked content
- Links disappear when you edit a post but return after a cache purge or a few hours
- Spam is visible to logged-out visitors or from search results but not when you are logged in
- Backlink or crawl tools show many outbound links from your pages to domains you do not know
- Theme or plugin files show recent modification dates you cannot explain
Most likely causes
- 01 A vulnerable, outdated, or abandoned plugin or theme that allowed unauthorized changes
- 02 Pirated or nulled themes and plugins that ship with hidden link code
- 03 Stolen or weak passwords for wp-admin, hosting, SFTP, or the database
- 04 Malicious entries in the database such as widget text, options, or post content
- 05 Backdoor files that re-insert the links after you remove them
- 06 Rogue administrator accounts or scheduled tasks created during the break-in
- 07 A compromised sibling site on the same hosting account writing into this install
- 08 A third-party script or ad partner serving unwanted links into your pages
What changed before the problem started
- A plugin or theme update was skipped, failed, or the vendor stopped supporting the product
- A free or unofficial theme or plugin was installed from a non-official source
- A new administrator, contractor, or shared login was added without two-factor authentication
- Search Console began showing unfamiliar queries, URLs, or security alerts
- The host reported modified files, malware, or unusual outbound activity
- A restore or migration copied older infected files or database content back in
Troubleshooting steps
- 01
Confirm the links and find where they appear
Use view-source and a crawler-style check on several pages, including the homepage, a post, and a category page, and list every unfamiliar outbound link. Check Search Console Security issues for sample URLs. Success signal: you have a written list of affected pages and link destinations.
- 02
Preserve a copy before changing anything
Download the site files and export the database to a location outside the web root. Success signal: you can compare before and after and later find how the attacker got in.
- 03
Replace code from trusted packages
Reinstall WordPress core, plugins, and themes from official sources or licensed vendors, and delete anything unused, abandoned, or pirated instead of just deactivating it. Review uploads, mu-plugins, and the root for files that should not exist. Success signal: every active component matches an official package.
- 04
Clean database content and users
Review widgets, options, post and page content, and scheduled events for injected links, and remove administrator accounts you do not recognize. Check any reusable blocks or theme settings that output HTML. Success signal: view-source shows only the links you intend and only known users remain.
- 05
Rotate credentials and patch the entry point
Change WordPress, hosting, SFTP/SSH, database, and registrar passwords, regenerate salts, enable two-factor authentication on privileged accounts, and update or remove the vulnerable component. Success signal: old sessions fail and the links do not return after a cache purge and a day or two of monitoring.
- 06
Clear caches and re-verify as a crawler
Purge page, object, and CDN caches, then re-check view-source and the Search Console URL Inspection result for sample pages. Success signal: rendered and cached copies show no injected links.
- 07
Request review and handle leftover URLs
If Google flagged the site, request a Security issues review after everything is clean. Make removed spam URLs return a proper 404 or 410. Success signal: the review is queued and no known spam URL is live.
When to stop troubleshooting
Stop and escalate if links return after cleanup, you cannot find a clean backup, administrator accounts keep reappearing, the host reports malware you cannot locate, or Google rejects your review. Keep logs and the evidence copy so a responder can trace the entry point.
Information to collect before requesting help
- 01 List of affected pages and the spam link destinations you found
- 02 Screenshots of view-source, search snippets, and Search Console security alerts
- 03 WordPress, PHP, plugin, and theme versions with last update dates
- 04 Whether any theme or plugin came from outside official sources
- 05 Hosting provider, whether other sites share the account, and any scan reports
- 06 List of administrator users and recent credential or access changes
- 07 Last known-good backup date and when the links first appeared
- 08 Caching or CDN layers in front of the site
How a professional repairs the problem
Rescue 404 preserves a forensic copy, locates injections across theme and plugin files, the database, widgets, and scheduled tasks, and rebuilds from verified sources. We remove rogue users and backdoors, rotate every credential, add two-factor authentication, patch the entry point found in the logs, purge caches, and validate as a crawler and logged-out visitor. If Google flagged the site we submit a precise review and keep monitoring for reinfection.
Frequently asked questions
Why do the links come back after I delete them? +
Why can I not see the links on my page? +
Could my caching plugin be the cause? +
Do I have to delete the spam pages from Google? +
Is this a Google penalty? +
Can a plugin remove the links automatically? +
Repair dispatch
Still Need Help Fixing Your Website?
If you are not comfortable editing website files, changing server settings, repairing a database, or troubleshooting a live website, professional help may prevent additional damage or downtime. We will review the problem before accepting the repair.
- You will receive a clear explanation of the likely cause.
- We will tell you if the issue falls outside our repair scope.
- No additional work will be performed without approval.
- A backup should be created whenever access and website condition allow it.
Do not share passwords through an unencrypted contact form — use Password Pusher (self-destructing link). Prefer a dedicated Rescue 404 admin account, not your personal owner login; if you cannot create one yet, we will add ours after repair.