How to Remove Casino Spam from WordPress
Casino spam on WordPress usually appears as injected pages, hidden links, spammy redirects, or hacked SEO content that targets gambling keywords.
This guide shows how to identify the infection, remove the malicious code, and secure your site so the spam does not return.
What casino spam looks like on a WordPress site
Casino spam is a form of SEO spam where attackers add gambling-related content to your site to manipulate search results.
It can affect posts, pages, widgets, theme files, database entries, and even server-level configurations.
- Spammy pages targeting casino, poker, slots, or betting keywords
- Hidden links in footer text, widgets, or post content
- Redirects that send visitors to gambling domains
- Suspicious new administrator accounts
- Injected meta titles and descriptions in search snippets
- Unfamiliar files in
wp-content,uploads, or theme folders
In many cases, the visible symptom is only the last step of the compromise.
The original entry point is often a weak password, outdated plugin, nulled theme, or an unpatched vulnerability in WordPress core, a plugin, or a theme.
First steps before you start cleanup
Before changing anything, create a full backup of the infected site and database.
A backup gives you a recovery point if you remove the wrong file or need to compare clean and infected versions later.
- Put the site in maintenance mode if possible
- Back up files and the database separately
- Record the current symptoms, URLs, and redirects
- Check Google Search Console and server logs for patterns
If your site is part of a business or receives traffic from search, consider notifying your hosting provider.
Many hosts can help isolate malicious files, identify recent intrusion timestamps, and restore access logs.
How to find casino spam on WordPress
Finding every trace of the spam is the most important part of the cleanup.
Attackers often hide content in multiple places so it survives a partial cleanup.
Scan WordPress files for suspicious code
Look for recent file changes, unfamiliar filenames, and code that is obfuscated or heavily encoded.
Common red flags include base64_decode, eval, long strings of random characters, and unexpected remote requests.
- Check
wp-content/themesfor modified template files - Inspect
wp-content/pluginsfor unknown plugins - Review
wp-content/uploadsfor PHP files, which do not belong there in a normal setup - Search for casino keywords in theme files and post content
Inspect the database
Casino spam is often stored in the database rather than in visible files.
Check posts, pages, custom post types, widgets, options, and metadata for spam terms and hidden links.
- Look in
wp_postsfor pages or posts you did not create - Check
wp_optionsfor injected scripts or altered site URLs - Review
wp_postmetafor suspicious redirect values - Search for external domains tied to gambling or casino promotions
Use security tools for a second opinion
Security plugins and server malware scanners can help surface infected files faster than manual review alone.
Tools from vendors such as Wordfence, Sucuri, MalCare, and SiteGround Security can flag known malware signatures, file changes, and suspicious behavior.
How to remove casino spam from WordPress safely
Once you identify the infection, remove it in layers: content, files, accounts, and configuration.
Do not delete random files without checking whether they belong to WordPress core, your theme, or a required plugin.
Remove malicious posts, pages, and links
Delete any spam pages, drafts, or custom content created by an attacker.
If a legitimate page was modified, restore it from a clean backup or replace the content manually.
- Remove casino-related pages and categories
- Clean widget text blocks and reusable blocks
- Strip hidden links from menus, headers, and footers
- Review SEO plugin titles and meta descriptions
Replace compromised core, theme, and plugin files
Download fresh copies of WordPress core, your active theme, and each plugin from trusted sources.
Overwrite compromised files instead of editing them in place, especially if you found obfuscated code or unknown modifications.
- Reinstall WordPress core from the official package
- Delete and reinstall plugins from the WordPress repository or the vendor
- Replace the theme with a clean version from the original developer
- Remove any nulled or pirated software immediately
Clean the database entries
If spam remains after file cleanup, remove malicious entries from the database.
Use phpMyAdmin, Adminer, WP-CLI, or a trusted database tool to search for known spam terms and injected scripts.
- Delete rogue posts and pages
- Remove fake user records if present
- Clean infected options and widgets
- Verify that site URLs, home URLs, and redirect settings are correct
Delete suspicious admin accounts and reset access
Attackers frequently add hidden administrator accounts so they can return after cleanup.
Review all users with administrator privileges and remove anything you do not recognize.
- Delete unknown admin users
- Reset passwords for all users, especially admins
- Regenerate security keys and salts in
wp-config.php - Log out all sessions if your hosting or security plugin supports it
How to stop the spam from coming back
Cleanup without hardening often leads to reinfection.
The most reliable way to prevent future casino spam is to close the same door the attacker used the first time.
Update everything
Outdated software is one of the most common causes of WordPress compromise.
Keep WordPress core, plugins, themes, and PHP updated, and remove anything unused.
- Enable automatic updates where appropriate
- Delete inactive plugins and themes instead of leaving them installed
- Use only maintained plugins with a trustworthy update history
Harden login and file access
Brute-force attacks and stolen credentials are common entry points.
Strengthen authentication and reduce the ability of attackers to write files directly.
- Use strong, unique passwords
- Enable two-factor authentication for admins
- Limit login attempts with a trusted plugin or host-level protection
- Set correct file permissions and disable unnecessary file editing in the dashboard
Add firewall and malware protection
A web application firewall can block many malicious requests before they reach WordPress.
Pair it with scheduled malware scans and file integrity monitoring so you can detect issues earlier.
- Use a firewall from Cloudflare, Wordfence, Sucuri, or a managed host
- Schedule weekly malware scans
- Enable alerts for file changes and new admin users
- Review logs after every suspicious spike in traffic or failed logins
How to check if Google still shows casino spam
Even after cleanup, search engines may continue showing old spam URLs until they recrawl the site.
Use Google Search Console to inspect indexed pages, request reindexing, and report removed spam URLs.
- Submit clean URLs for indexing
- Use the URL Inspection tool on affected pages
- Check the Coverage and Security Issues reports
- Remove any hacked pages from sitemaps
If the spam created many indexed URLs, the cleanup may take time to fully disappear from search results.
Keep monitoring Search Console, analytics, and server logs until the infected patterns are gone.
When to restore from backup instead of manual cleanup
A full restore is often faster and safer when the infection is widespread or the site has been modified for a long time.
If you have a clean backup from before the compromise, restoring that version and then updating everything may be the best option.
- Use a backup if many core files were modified
- Restore if the database contains extensive spam content
- Choose restoration when you cannot confirm the attack source
- Follow the restore with password resets and security hardening
Checklist for removing casino spam from WordPress
- Back up the site and database
- Identify spam pages, redirects, and hidden links
- Scan files, themes, plugins, and database tables
- Replace compromised WordPress files with clean copies
- Remove malicious users and reset all credentials
- Update WordPress core, plugins, themes, and PHP
- Enable a firewall, scans, and two-factor authentication
- Verify clean indexing in Google Search Console
With a structured cleanup process, you can remove casino spam from WordPress, restore site integrity, and reduce the risk of another compromise.
The key is to treat visible spam as a symptom and fully address the files, database, access control, and server security behind it.