Tornado SEO

How to check if your WordPress site was hacked for SEO spam

By Thibault · Updated · 6 min read

To check if your WordPress site was hacked for SEO spam, run a site: search on your domain, open the Security Issues report in Search Console, and test suspicious URLs with the URL Inspection tool to see what Google sees. Then compare your core files with the official WordPress checksums and look for unknown admins, owners and sitemaps.

What are the signs of an SEO spam hack on WordPress?

An SEO spam hack usually shows up in Google before it shows up on your site. Attackers add pages, hidden links or redirects aimed at searchers and search engines, while the pages you see as the owner look normal. Google's spam policies list four forms of hacking: code injection, page injection, content injection and redirects. Attackers often add cloaking so you have a harder time spotting the changes.

  1. Pages you never wrote appear in Google, often with random folder names, Japanese text, or pharmacy, casino and replica product keywords.
  2. Your search results show titles and descriptions in a language you do not publish in.
  3. Visitors coming from Google land on another site, while typing your URL directly works fine.
  4. Search Console sends you a message about a new verified owner you do not know.
  5. The number of indexed pages or impressions jumps on queries that have nothing to do with your business.
  6. Search Console or a browser shows a security warning for your domain.

How do you check Google's index with a site: search?

A site: search is the fastest free check, because it lists the pages Google has indexed on your domain, including the ones the attacker created.

  1. Search site:yourdomain.com in Google and scroll through several pages of results.
  2. Add spam keywords to narrow it down: site:yourdomain.com casino, site:yourdomain.com viagra, or a few Japanese characters.
  3. Look for URL patterns you never created, such as numbered .html pages inside random folders. Google's own example for the Japanese keyword hack is a path like /ltjmnjp/341.html.
  4. If Google shows nothing odd, run the same search on Bing. A spam page can be indexed by one search engine before the other.
  5. Write down every suspicious URL. You will need this list to test your cleanup later.

What does Search Console show after a hack?

Search Console is where Google tells you directly that it found hacked content, and where attackers often leave traces of their own.

  1. Open the Security Issues report. Google lists hacked content there as malware, code injection, content injection or URL injection, with sample URLs.
  2. Open Settings, then Users and permissions, and check every owner. An attacker who verifies your property can submit their own sitemaps.
  3. Open the Sitemaps report and look for any sitemap you did not add. Google's cleanup guide says attackers often add or modify sitemaps to get their URLs indexed faster.
  4. In the Pages report, check whether the number of indexed pages went up while you published nothing.
  5. In the Performance report, sort queries by impressions and look for terms that have nothing to do with your site.

How do you see what Google sees when the hack uses cloaking?

The URL Inspection tool in Search Console shows the page as Googlebot gets it, and that is the only reliable way to beat cloaking.

Cloaked spam serves the spam to Googlebot or to visitors coming from search results, and a clean page to everyone else. Google warns that a page returning a 404 to you may still exist for searchers. Do not trust your own browser.

  1. Paste a suspicious URL into URL Inspection and run a live test.
  2. Open the rendered HTML and the screenshot, and search the code for links, keywords or scripts you did not add.
  3. Test your home page and two or three normal articles too. Injected links often sit on legitimate pages.
  4. Click your own result in Google, then type the same URL directly in the address bar. Google notes that some malicious redirects only trigger from search results.
  5. Repeat the test on a phone. Redirects can depend on the device.
Thibault's take In my experience, the owner is the last person to see this kind of hack. The code checks for a logged-in cookie or a Googlebot user agent, and you browse a perfectly clean site. So I always start from Google's side: site: search, URL Inspection, Search Console. Accessibility comes before visibility here too. If Googlebot gets a different page than your visitors, the rest of your SEO work counts for nothing.

Which WordPress files should you check first?

Start by comparing your WordPress core files with the official checksums, then review what is left by date, size and content.

  1. Back up all files and the database before touching anything, and keep an offline copy of everything you delete.
  2. Run wp core verify-checksums with WP-CLI. It compares your core files with the MD5 checksums published by WordPress.org for your version. Add --include-root to get a warning about any non-WordPress item in the root folder.
  3. Find every .htaccess file, including hidden ones. Attackers use them to redirect visitors or to send fake URLs to a PHP file that generates spam. Replace them with the default WordPress version.
  4. Open the files Google says attackers inject most often: index.php, wp-load.php, 404.php and view.php.
  5. Sort files by modification date and look at the ones changed around the day the spam appeared. Then sort by size and check any unusually large file.
  6. Search the code for functions used to hide code, such as base64_decode, eval, gzinflate, strrev and rot13, and for very long single lines.
  7. Check wp-content/uploads for PHP files. That folder should hold media, not code.

How do you check the database and admin accounts?

Clean files do not prove a clean site, because spam links and backdoor accounts often live in the database.

  1. List administrators with wp user list --role=administrator and delete any account you do not recognize.
  2. Check the siteurl and home values in the wp_options table. A changed value sends your traffic somewhere else.
  3. Search wp_posts for script tags, iframes, display:none and spam keywords. Hidden links in old articles are classic content injection.
  4. Review comments and any public area of the site. Google also treats user-generated spam, such as comment spam, as a problem on your site.
  5. Change every password: WordPress admins, hosting, SFTP, database, and the email accounts tied to your admin users.

What should you do once you have confirmed the hack?

Cleaning the spam is half the job, because the attacker comes back until you close the way in. Google's cleanup guide notes that 20% of hacked sites are hacked again within one day.

  1. Reinstall WordPress core, themes and plugins from official sources, and delete every plugin and theme you do not use.
  2. Update everything and turn on automatic updates. Old WordPress versions no longer get security fixes.
  3. Remove unknown Search Console owners and their verification files, then delete the fake sitemaps.
  4. Test every URL on your list with URL Inspection. A clean result shows Not Found with no hidden content.
  5. If the Security Issues report lists problems, fix every affected page, then click Request Review and explain the problem, what you did and the result. Google says most reviews take several days or weeks.
  6. Harden the install: two-step authentication, no username like admin, files at 644 and folders at 755, and DISALLOW_FILE_EDIT set to true in wp-config.php.
Thibault's take I do not trust a cleanup I cannot explain. If you cannot find how the attacker got in, assume they still have a door open, and restore a backup dated before the infection. The attacker is selling your domain's trust. That same trust is what gets you ranked by Google and cited by AI models, so protect it like a business asset.

Frequently asked questions

Can my WordPress site be hacked without me seeing anything?

Yes. Cloaking shows the spam only to Googlebot or to visitors coming from search results, so the site looks clean when you browse it. Check with a site: search and the URL Inspection tool.

Will an SEO spam hack hurt my rankings?

It can. Google says hacked sites can rank lower or drop out of search results, and a hacked site can also harm the people who visit it. The longer the spam stays indexed, the more it costs you.

Is a security plugin enough to detect SEO spam?

I would not rely on it alone. A scanner can miss cloaked pages and database injections, and malware running on your server can hide from it. Combine it with Google's view of your site and a checksum comparison.

How do I remove the spam pages from Google?

Delete them so they return a 404 or 410, remove the fake sitemaps, and let Google recrawl. For urgent cases, the Removals tool in Search Console hides URLs temporarily while that happens.

Should I request a review if Search Console shows no security issue?

No. A review request only applies when the Security Issues report lists a problem. If the report is empty, clean the site and let Google recrawl the affected URLs.

Sources

  1. developers.google.com/search/docs/essentials/spam-policies
  2. developers.google.com/search/docs/monitor-debug/security/what-is-hacked
  3. support.google.com/webmasters/answer/9044101
  4. web.dev/articles/fix-the-japanese-keyword-hack
  5. developer.wordpress.org/advanced-administration/security/hardening/
  6. developer.wordpress.org/cli/commands/core/verify-checksums/

Stay ahead of every search update

Google, ChatGPT, Gemini, Claude: what changed, why it matters, and what to do about it. Every morning, in 3 minutes, free.

What the...?