SiteUnhack. Get a free assessment

Guides · SEO spam

Japanese spam in Google, and why your site looks fine to you

You search for your own business and something's wrong. Under your domain, Google is showing page after page of Japanese text: cheap designer bags, watches, sneakers. You click one and land on your normal homepage, or on a shop you've never heard of. You open your site and it looks exactly the same as always.

This is the Japanese keyword hack. It's one of the most common ways WordPress sites get abused, and it's built to be invisible to the person who owns the site. Here's how it works, how to see what Google sees, and how to clean it up so it stays gone.

What the attacker is actually doing

Your site isn't the target. Your site's reputation with Google is. An older domain that Google trusts can get new pages ranked quickly, so the attacker uses yours to host thousands of spam pages that point people towards fake shops.

The clever part is that the spam is only shown to search engines. When the request comes from Googlebot, the hacked code serves a page full of Japanese keywords and links. When it comes from you, or from any normal visitor, it serves your real site. This trick is called cloaking, and it's why you can stare at your own website all day and never see a thing.

Visitors who click a spam result from Google are often sent somewhere else again, usually to the fake shop. So the people affected are searchers, and the damage is to your search traffic and your name.

How to check what Google sees

Don't trust what your browser shows you. Use one of these instead.

  1. Search Google for site:yourdomain.com (with your own domain). Scroll through a few pages of results. Japanese titles, or pages you never created, are the giveaway. Adding a word like site:yourdomain.com 激安 ("super cheap") or site:yourdomain.com japan can surface them faster.
  2. Open Google Search Console and look at Performance. If the queries list is full of Japanese searches you've never targeted, that's the spam getting impressions. Also check Pages for a sudden jump in indexed pages.
  3. Use URL Inspection on one of the spam URLs and click Test live URL, then View tested page. This is Google fetching the page right now, from Google's own servers. If you see Japanese text there but not in your browser, you've confirmed the cloaking.
  4. Run our free spam check. It loads your pages as a normal visitor and as a search engine and compares the two, and it reads your sitemaps looking for pages that only exist for bots.

Pretending to be Googlebot isn't always enough. Some of these scripts check that the request really comes from Google's network, not just that it says it's Googlebot. If a quick test shows nothing but Google's results still look wrong, trust Google. URL Inspection is the most reliable check because it really is Google.

Check this first: Search Console owners

This step gets skipped all the time. Attackers often verify themselves as an owner of your site in Google Search Console, so they can submit their own sitemaps and push their spam pages into Google faster.

In Search Console, go to Settings, then Users and permissions. If there's an owner you don't recognise, remove them. Then look at how they were verified. It's usually an HTML file in your site's main folder with a name like google1a2b3c4d5e.html, or a meta tag added to your theme. Delete the file or tag too, otherwise they can simply verify again. Finally, open Sitemaps and remove any sitemap you didn't submit.

Where the code hides in WordPress

The spam pages usually aren't real WordPress posts, so you won't find them under Posts or Pages. They're made up on the fly by code somewhere in your site. The usual places:

  • The main index.php or wp-config.php, with a few extra lines at the very top that decide who's a bot.
  • The .htaccess file, with rewrite rules that send certain URLs to a hidden PHP file.
  • Odd folders and files in the site's main folder or inside wp-content, often with random names, sometimes holding thousands of cached spam pages.
  • A modified or fake plugin, or the "must use" plugins folder, which runs automatically and doesn't appear in your Plugins screen.
  • The theme's functions.php and the database, where spam text and settings can be stored in options.
  • Fake sitemaps, such as extra XML files listing the spam pages so Google finds them all.

Sorting files by date modified is a good way to start, but don't rely on it. Attackers routinely change the dates on their files to match yours.

Cleaning it up properly

  1. Back up everything first, files and database, infected or not. It's your evidence, and your way back if something breaks.
  2. Remove the attacker from Search Console as described above, including their verification file and sitemaps.
  3. Reinstall WordPress core, every plugin and your theme from clean copies. Not just the ones that look odd. Keep wp-content/uploads and your database, then check those by hand.
  4. Check .htaccess, wp-config.php, the main index.php and the must use plugins folder line by line. These survive a plugin reinstall.
  5. Look through uploads for anything that isn't media. PHP files have no business there, and neither do folders full of HTML pages.
  6. Look for admin users you don't recognise, then change every password: WordPress, hosting, database and SFTP. Log everyone out.
  7. Check other sites on the same hosting account. One infected neighbour can reinfect a site you've just cleaned.
  8. Confirm with Google's eyes. Run URL Inspection's live test on a few of the old spam URLs. They should now show a normal page or a "not found".

Getting the spam out of Google

Cleaning the site and cleaning Google's results are two different jobs. Google only drops the spam pages once it revisits them and finds they're gone, and with thousands of pages that takes a while. A few things help.

  • Let the spam URLs return "not found" (a 404 or 410). Don't redirect them all to your homepage. Google can treat that as a soft error and keep the pages around longer.
  • Don't block the spam URLs in robots.txt. It sounds sensible, but it stops Google from seeing that the pages are gone, so they can linger in results.
  • Submit your real sitemap again in Search Console, so Google recrawls the site.
  • Use the Removals tool for the worst ones. It hides URLs from results for about six months while Google catches up. It's a sticking plaster, not a fix, so only use it after the site is clean.
  • If there's a Security issues or Manual actions report in Search Console, request a review once you're sure the site is clean.

Expect the spam to fade out over a few weeks. Rankings for your real pages usually come back once the spam is gone, but Google decides the timing, so be wary of anyone promising a date.

Why it keeps coming back

If the spam returns days or weeks after a cleanup, something was left behind. Usually it's one of these: a backdoor in a file nobody checked, an attacker still listed as a Search Console owner, a plugin that wasn't reinstalled, or another site on the same account. The way in also has to be closed, which usually means an outdated plugin or a reused password.

Need a hand?

If the free check shows Google is being fed something different, or you've cleaned this once and it's back, we can investigate and clean it properly. You'll get a written report of what we found, what we changed and how it got in, and we'll help you get the spam out of Google afterwards. We agree the scope and price with you before any paid work starts.

Run the free spam check Or request a security review