Talk to the NOC, IST hours — +91 75994 50220 support@bigdomainhost.com
Guide

WordPress hacked with Japanese spam pages or redirects: how to clean it and stop it coming back

Japanese titles under your domain in Google, or visitors bounced to a spam shop, mean the site has been compromised. This guide walks through confirming the hack, finding the files that cause it, cleaning or restoring, closing the hole, and clearing the spam out of Google.

Short answer: The Japanese keyword hack creates thousands of spam pages with Japanese text on a hacked WordPress site, often shown only to Googlebot. To fix it: copy the infected site, change every password and the wp-config salts, remove unknown admins and Search Console owners, check files with wp core verify-checksums and wp plugin verify-checksums --all, reinstall code from official sources or restore a clean backup, update or remove vulnerable and nulled plugins, make the spam URLs return 404, and request a review in the Search Console Security issues report.

What the Japanese keyword hack is, and how to confirm you have it

The Japanese keyword hack is a spam attack in which someone gets into your WordPress site and creates thousands of pages full of auto-generated Japanese text, usually selling fake branded goods through affiliate links. Google indexes those pages under your domain, so Japanese titles appear when people search for your site, and some visitors arriving from Google get redirected to a spam shop. The fix is to remove the attacker's access and files, then clean up what Google has indexed.

Confirm it in three ways before you change anything:

  • A site: search. Search Google for site:example.in and page through the results. Spam pages usually sit in random-looking folders, such as /abc123/?id=48291, with Japanese titles. Try site:example.in on Bing too.
  • Search Console. Open the Security issues report. If Google has detected hacked content, it is listed there with sample URLs. Also check Settings > Users and permissions for an owner you do not recognise. Attackers often verify themselves as owners so they can submit their own sitemaps.
  • Cloaking. Many infections show the spam only to Googlebot, or only to visitors who arrive from a Google results page. You open the URL directly and see a normal 404 or your home page. Put one of the spam URLs into the URL Inspection tool and view the crawled page to see what Google indexed, then select Test live URL to see what your server sends Googlebot right now.

If the spam only appears when you click from Google on a phone, while typing the address works, that is cloaking too. Do not take "it looks fine in my browser" as proof the site is clean.

The first hour: preserve, lock out, change secrets

Resist the urge to start deleting files. Work in this order:

  1. Take a copy of the infected state. Download the files and export the database, or take a snapshot if you are on a VPS. You may need it to work out how the attacker got in, and it is your fallback if a clean-up step breaks something. Label it clearly so nobody restores it by mistake.
  2. Change every password that touches the site. Hosting control panel, cPanel, every WordPress administrator, FTP and SFTP accounts, the database user (then update DB_PASSWORD in wp-config.php), and the email account that receives password resets. Do it from a computer you have scanned for malware, because a keylogger on your own laptop would hand the new passwords straight back.
  3. Log everyone out. Replacing the secret keys and salts in wp-config.php invalidates every login cookie. With WP-CLI: wp config shuffle-salts.
  4. Remove unknown owners from Search Console, and delete their verification token. Google's own clean-up guide notes this is usually an HTML file in the site root, or a rewrite rule in .htaccess that fakes one for any google*.html request.
  5. Consider maintenance mode if the site is redirecting your customers to spam. A short "back soon" page is better than sending them to a scam shop.

Find the infection

The spam pages are the symptom. The real problem is the code that creates them and the back door that lets the attacker return. Check each of these places. The commands below use WP-CLI, which you can run on a VPS or on any hosting plan that gives you SSH access. Run them from the WordPress folder, and add --skip-plugins --skip-themes to each one (for example wp core verify-checksums --skip-plugins --skip-themes). WP-CLI normally loads WordPress, including the infected plugins and theme, and those flags stop that code running, hiding itself or changing the output while you inspect the site. Code injected into wp-config.php or mu-plugins still loads, so if WP-CLI crashes or behaves oddly, inspect the files directly.

Administrator accounts

wp user list --role=administrator --skip-plugins --skip-themes

Delete any administrator you did not create, after checking its registration date. Attackers often pick names that look like plugins or support staff.

Modified core files

wp core verify-checksums --skip-plugins --skip-themes
wp core verify-checksums --include-root --skip-plugins --skip-themes

This downloads the official checksums from WordPress.org for your installed version and lists every core file that does not match. The --include-root option also warns about files in the root folder that are not part of WordPress, a common place for a dropped script or verification token. (--include-root needs WP-CLI 2.8 or newer; check with wp cli version.)

Modified plugins

wp plugin verify-checksums --all --skip-plugins --skip-themes

This compares plugin files against WordPress.org's checksums. Premium plugins that are not hosted on WordPress.org cannot be checked this way, so treat them as suspect and reinstall them from the vendor's download.

PHP files where they do not belong

The uploads folder should hold images and documents, never PHP. List any PHP files there, and any PHP files changed recently:

find wp-content/uploads -type f -name "*.php"
find . -type f -name "*.php" -mtime -30
find . -type f -name "*.php" -ctime -30

Set the number of days to reach back to before the first spam URL appeared, not just the last few weeks. Attackers often use touch to make a file's modification time (-mtime) look old. The change time (-ctime) cannot be set back that way, but it also changes when you restore or copy files, so treat both as clues rather than proof.

Open anything suspicious in a text editor rather than a browser. Signs of injected code include one extremely long line, and functions such as eval, base64_decode, gzinflate, str_rot13 or strrev wrapped around unreadable strings. Common targets include index.php, wp-load.php and a theme's 404.php.

.htaccess, wp-config.php and cron

  • .htaccess: look for every .htaccess file, including those in subfolders. Rewrite rules that send search-engine visitors or certain user agents elsewhere are how the redirects and cloaking work. Replace the root file with the standard WordPress block, unless you know you added custom rules.
  • wp-config.php: look for include or require lines pointing at unfamiliar files, and for code above the opening comment.
  • WordPress cron: wp cron event list --skip-plugins --skip-themes shows scheduled hooks. An unfamiliar hook can recreate files after you delete them. In cPanel, also check Cron Jobs for commands you did not add.

The database

Spam can live in the database as well as in files. Check that siteurl and home are correct, and look in the options table (wp_options, or <prefix>options if $table_prefix in wp-config.php is not wp_) for options with unfamiliar names holding long encoded values. wp option list --search="*keyword*" --skip-plugins --skip-themes searches option names without opening the database. Search the posts table for injected <script> tags or hidden links. If you are not comfortable editing the database, restoring a clean backup is usually safer.

Clean or restore

You have three options. Pick based on how long the site has been infected and whether you have a backup from before that date.

OptionWhen it fitsWatch out for
Restore a clean backupYou know roughly when the hack started and have a backup from before itContent added since is lost. The hole is still open, so patch before going live.
Reinstall code, keep contentNo clean backup, but the database looks intactEvery file outside core, plugins and themes must be checked by hand, especially uploads.
RebuildInfection is old, widespread, or keeps coming backTakes longer, but you export only posts, pages and media, not code.

To reinstall code from official sources while keeping your content:

wp core download --skip-content --force --version=$(wp core version --skip-plugins --skip-themes) --skip-plugins --skip-themes
for p in $(wp plugin list --status=active --field=name --skip-plugins --skip-themes); do
  v=$(wp plugin get "$p" --field=version --skip-plugins --skip-themes)
  wp plugin install "$p" --version="$v" --force --skip-plugins --skip-themes
done

The first command replaces WordPress core files without touching your themes and plugins. The --version part keeps the version you already run; leave it out to upgrade at the same time. It overwrites core files but does not delete extra files an attacker dropped into wp-admin or wp-includes. Delete those two folders first, or delete every file that verify-checksums reports as "File should not exist".

The loop reinstalls each active plugin from WordPress.org at the version you already have, so nothing is upgraded by surprise. Run it again with --status=inactive. Without --version, wp plugin install --force fetches the latest release and updates every plugin at once. Premium plugins fail here, so reinstall them from the vendor. Must-use plugins and drop-ins cannot be reinstalled this way either: check wp-content/mu-plugins and the drop-in files (advanced-cache.php, object-cache.php, db.php in wp-content) by hand, because they are common places for malware to hide. Do the same for your theme, and delete themes and plugins you no longer use rather than leaving them deactivated. Remove PHP files from uploads and any unknown files found earlier. Then run the checksum commands again until they come back clean.

If a reinstall leaves you with a blank page or a version clash, see the WordPress white screen of death fix.

Close the hole so it does not come back

Google's guide warns that a site cleaned without fixing the cause is often hacked again quickly. The usual ways in:

  • Outdated plugins and themes with known vulnerabilities. Update everything, and remove what is abandoned by its developer.
  • Nulled themes and plugins. Pirated copies of paid products are a common source of infection, because the "free" download often contains a back door. Replace them with genuine copies or free alternatives.
  • Old PHP. PHP 8.1 and older no longer receive security fixes from the PHP project, and PHP 8.2 gets them only until 31 December 2026. WordPress.org recommends PHP 8.3 or newer. See what is PHP for how to check and change the version in cPanel.
  • Weak or reused passwords on admin accounts. Add two-factor authentication for every administrator, which the WordPress hardening guide recommends.
  • Plain FTP. FTP sends your password unencrypted. Use SFTP, as explained in FTP vs SFTP vs FTPS.
  • Loose file permissions. WordPress's hardening guide uses 755 for folders and 644 for files, with wp-config.php readable only by you and the web server.

Also add define( 'DISALLOW_FILE_EDIT', true ); to wp-config.php. It switches off the theme and plugin editor in the dashboard, so a stolen admin login cannot be used to paste code straight into PHP files. It does not stop an admin uploading a malicious plugin or theme ZIP. To block that as well, use define( 'DISALLOW_FILE_MODS', true ); and update plugins through WP-CLI or the host instead.

Clean up Google after the site is clean

Only start this once the checksums pass and the spam URLs no longer load. Otherwise Google will find the pages again.

  1. Make spam URLs return 404 or 410. Google's documentation says it treats all 4xx codes except 429 the same way: the URL is removed from the index. So 404 and 410 both work, and you do not need to pick one for speed. Check that the URLs do not show a "not found" message with a 200 status, which Search Console reports as a soft 404. Test as a normal visitor, as Googlebot and as a visitor from Google, because cloaked spam may only show to the last two:
    curl -I https://example.in/spam-path/
    curl -I -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" https://example.in/spam-path/
    curl -I -e https://www.google.com/ https://example.in/spam-path/
    Then confirm with Test live URL in the URL Inspection tool, since some infections check Google's real IP addresses.
  2. Delete spam sitemaps. In Search Console, open Sitemaps and remove any sitemap you did not submit. Resubmit your real sitemap.
  3. Hide the worst URLs temporarily. The Removals tool hides URLs or a URL prefix from Google results for about six months. It does not remove them from the index for good, so the 404s still have to be in place.
  4. Request a review. If the Security issues report lists a problem, select Request Review and describe what you found and what you fixed. Google says reviews can take from several days to a few weeks. Do not resubmit while one is pending.

Expect spam URLs to linger in search results for some weeks while Google recrawls them. Watch the site: results and the Pages report in Search Console. If new spam URLs keep appearing after the clean-up, something is still recreating them.

If you are on Bigdomainhost

WordPress hosting and Web & cPanel hosting include Imunify360 malware scanning and a web application firewall, and the WordPress plans add a WordPress-aware firewall that blocks the usual wp-login and XML-RPC attacks. Both include daily backups kept for 30 days that you restore yourself from cPanel (JetBackup on Web & cPanel hosting, file by file or all at once), which is the quickest route back if you know when the hack started. PHP versions are selectable per domain in cPanel.

What you do yourself: the clean-up, changing your passwords, and the Search Console steps, because only the site owner controls those. Scanning and the firewall reduce the risk, but they do not replace updating plugins and removing nulled code. If you cannot find your restore points or the scan results in cPanel, ask support. On a KVM VPS, take a snapshot of the infected server before cleaning so you can always go back.

This guide was written with AI assistance and checked against the official documentation listed in its sources on 23 November 2026.

Sources (checked )

Answers

Frequently asked questions

Still unsure? Call +91 75994 50220 or write to support@bigdomainhost.com — a human replies in IST hours.

What is the Japanese keyword hack?

It is a spam attack on a hacked website that creates many new pages filled with auto-generated Japanese text, usually promoting fake branded goods through affiliate links. Google indexes the pages under your domain, so Japanese titles appear in search results for your site. The pages are often hidden from normal visitors and shown only to Googlebot.

Why do I see Japanese characters in Google search results for my site but not on my website?

That is cloaking. The injected code serves spam to Googlebot, or to visitors who arrive from Google, and a normal page to everyone else. Use the URL Inspection tool in Search Console to see what Google actually received for one of the spam URLs.

Why is my WordPress site redirecting to a spam site?

Usually a rewrite rule in .htaccess or injected PHP sends certain visitors, such as those coming from search engines or on mobile, to another domain. Check every .htaccess file, look for modified core files with wp core verify-checksums, and search for PHP files in the uploads folder.

Will deleting the spam pages remove them from Google?

Google removes a URL from its index when it returns a 404 or 410 status, but only after it recrawls the page, which can take weeks. The Search Console Removals tool hides URLs for about six months while that happens. If a Security issues warning is shown, request a review once the site is fully clean.

Can I remove malware from WordPress in cPanel without a plugin?

Yes. You can restore a clean backup from cPanel, replace WordPress core, themes and plugins with fresh copies from official sources, and delete unknown files with File Manager. With SSH access, WP-CLI checksum commands make it much easier to find modified files.

How do I stop my WordPress site getting hacked again?

Find and fix the way in: update or remove outdated plugins and themes, replace any nulled copies, run a supported PHP version, use SFTP instead of FTP, and turn on two-factor authentication for administrators. Disabling the dashboard file editor in wp-config.php also limits what a stolen login can do.

Support that picks up the phone.

In IST hours, in Hindi or English, and WhatsApp replies fastest at any time. Sales, migration and emergencies all reach the same engineers. No offshore queue, no 48-hour first reply.

Need cPanel or WHM with the ports already sorted?

Web & cPanel hosting comes with cPanel ready to log in to, reseller hosting adds white-label WHM, and a KVM VPS can have cPanel & WHM pre-installed. Call +91 75994 50220 or email support@bigdomainhost.com.