Finding out that your WordPress site has been hacked is stressful. Google may be showing Japanese text or casino links under your company name, visitors may be redirected to a scam page, or your host may have taken the site offline. The good news is that most hacks follow a few familiar patterns, and the official WordPress.org and Google documentation describe a clear way out.
Short answer: back up the hacked site, tell your host and change every password. Then replace WordPress core, plugins and themes with clean copies, remove unknown admins and files, check .htaccess and wp-config.php, change the security keys and clean the database. Close the hole (usually an outdated plugin) and request a review in Google Search Console.
Every step and figure below comes from official documentation or the primary security reports, checked on 6 December 2026; sources are listed at the end.
Signs your WordPress site has been hacked
WordPress.org’s “FAQ My site was hacked” lists Indicators of Compromise such as a Google or Bing blocklisting, a host suspension, a malware flag, visitors’ antivirus warnings, new users you did not create, or a hack you can see in the browser. The signs owners notice most often:
| Sign | Where you see it | What it usually means |
|---|---|---|
| Japanese text, fake brand shops, pills, casino or betting terms under your domain in Google | A site:yourdomain.com search |
Spam pages created on your site (Google calls this URL injection) |
| Spam links or text inside your normal pages | Page source, or URL Inspection in Search Console | Content injection |
| Visitors (sometimes only mobile visitors, or only visitors arriving from Google) sent to another site | Clicking your result in Google, on a phone | Redirect code in .htaccess, a PHP file or the database |
| “This site may be hacked” or a red browser warning | Search results, Chrome, Search Console | Google has detected hacked content or malware |
| Admin accounts you do not recognize | Users screen, or wp user list |
Attacker access that survives a password change |
| Unknown owners in Google Search Console | Search Console settings | The attacker verified your property to change sitemaps or settings |
| Host suspension or spam email complaints | Your host, email bounces | Malware or a mailer script running on the server |
The spam can be invisible to you. Google’s guides on the Japanese keyword and cloaked keywords hacks explain that hacked pages often show visitors normal content or a “Not Found” page while showing spam to Googlebot (cloaking). Use the URL Inspection tool in Search Console to see what Google sees, and check the Security Issues report for example URLs.
The first hour: what to do right away
WordPress.org’s FAQ starts with “Stay calm” and “Document”. Before you change anything:
- Write down what you see and when, plus anything that changed recently (a new plugin, a theme update, a new user). This becomes your incident report.
- Take a full backup of the hacked site, files and database. Both WordPress.org and Google recommend it: if a cleanup step breaks something you can go back, and it keeps the evidence.
- Contact your hosting provider. On shared hosting the hack may affect more than your site, and your host may have logs or a clean backup.
- Change the passwords for every access point WordPress.org lists: SFTP or FTP, WordPress admin, the hosting control panel and the MySQL database user, for every user with access.
- Scan your own computer. WordPress.org warns that many infections start with malware on the owner’s computer capturing FTP and admin logins.
- Check Search Console for strange owners and remove any you do not recognize, along with the verification token they used.
You will change the passwords again once the site is clean, because a back door left behind can expose the new ones.
How to clean a hacked WordPress site, step by step
If you have a clean backup from before the hack started, restoring it is often fastest, but you still need to update everything and close the hole. Google’s Japanese keyword guide quotes a study that found “20% of hacked sites are hacked again within one day.”
Otherwise, clean the site in place. The commands below use WP-CLI, the official WordPress command-line tool; each step has a manual equivalent over SFTP.
1. Verify and replace WordPress core
WP-CLI compares your core files with the checksums WordPress.org publishes for your version:
wp core version
wp core verify-checksums --include-root
--include-root also checks the files in the root folder and warns about anything that is not part of WordPress. Any file reported as changed, and any unexpected file in wp-admin/, wp-includes/ or the root, needs a closer look.
To replace core with a fresh copy of the same version without touching your content:
wp core download --force --skip-content --version=<your-version>
Two cautions from WordPress.org. Reinstall the same version you are running, because a different version can break the site. And an overwrite only replaces files WordPress knows about; hacks often add new files, so replace the wp-admin and wp-includes folders as a whole (delete them, then upload clean copies) rather than copying files over them. WordPress.org says both folders can be replaced safely.
2. Verify and reinstall plugins and themes
wp plugin verify-checksums --all
This checks plugins against WordPress.org’s checksums, so it can only verify plugins published in the WordPress.org directory. Premium plugins and themes bought elsewhere should be downloaded again from the vendor and reinstalled. Delete any plugin or theme you do not use; the WordPress.org hardening guide says to remove plugins you are not using.
3. Remove unknown users and log everyone out
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered
wp user delete <attacker-id> --reassign=<your-id>
wp user session destroy <user> --all
Check every role that can publish or install code, not just administrators. Then change the secret keys and salts, which logs out every session, including the attacker’s:
wp config shuffle-salts
Without WP-CLI, WordPress.org’s FAQ says to generate new keys with the official key generator at api.wordpress.org and paste them over the old ones in wp-config.php.
4. Check .htaccess, wp-config.php and the files that load on every page
WordPress.org calls .htaccess one of the files most often changed in a hack, and notes there can be copies in subfolders, not only in the root. Google’s guides suggest replacing it with a clean default copy unless you have custom rules. Redirects that only fire for visitors coming from search engines usually live here.
Then read wp-config.php line by line, and look at the files that run on every request: index.php and your theme’s header.php, footer.php and functions.php. Google’s guides describe what malicious PHP tends to look like: long jumbled strings, usually wrapped in functions such as base64_decode, eval, gzinflate, rot13 or strrev. Also look in wp-content/uploads/ for PHP files, which should not be there, and for recently modified or unusually large files.
5. Clean the database
Spam links, redirect scripts and fake admin users can sit in the database, where file checks never look. WP-CLI can search it:
wp db search '<script' --all-tables
wp db search 'eval(' --all-tables
Check the wp_options table (especially siteurl, home and widget settings), recently modified posts and pages, and the users table. Remove spammy URLs from your sitemaps, and delete any sitemap you did not create.
6. Update everything, then change the passwords again
Once the site is clean, update WordPress core, every plugin and every theme to the latest version. Then change all the passwords again, as WordPress.org advises, and consider a new database user and password (update wp-config.php to match). Finally, check that the spam URLs Google listed now return “Not Found”, using URL Inspection so you see what Googlebot sees.
If this is beyond your comfort level, bring in a malware-removal service or your host’s security team; WordPress.org’s support forums also offer free community help.
How to remove Google’s “This site may be hacked” warning
Google’s Security Issues report help page says affected pages “can appear with a warning label in search results” and may get “an interstitial warning page in the browser”. The report sorts hacked content into three types:
- Code injection: malicious code added to your pages.
- Content injection: spammy links or text added to your pages.
- URL injection: new pages created on your site, often full of spammy words or links.
To get the warning removed:
- Fix the issue on every affected page, not just the examples Google lists.
- In the Security Issues report, select Request Review.
- In the request, explain the problem, the steps you took to fix it, and the result.
- Wait. Google says a review “can take from a few days to a few weeks”. Do not send another request while one is pending; requesting a review before the problem is fixed can slow down your next request or mark you as a repeat offender.
WordPress.org’s FAQ notes that Bing and desktop antivirus products keep their own blocklists, so check Bing Webmaster Tools too.
WordPress security issues: how sites get hacked
The WordPress.org hardening guide says hacks are “most often attributed to the application itself”, rarely to the server, and that “many WordPress attacks are carried out autonomously by malicious software bots”. In other words, a bot scanning the internet finds an outdated plugin, not a person choosing your site.
Patchstack’s State of WordPress Security in 2026 report shows where the weak points are:
- 11,334 new vulnerabilities were found in the WordPress ecosystem in 2025, 42% more than in 2024.
- 91% were in plugins and 9% in themes. WordPress core had only 6, all of them low priority.
- 46% had no fix from the developer in time for public disclosure.
- About half of high-impact vulnerabilities were exploited within 24 hours, with a weighted median of 5 hours to the first exploit.
- Premium components were not safer: they had three times more known exploited vulnerabilities than free ones.
Google lists the same entry points in its guide to the top ways sites get hacked: compromised passwords, missed security updates, insecure or abandoned themes and plugins, social engineering such as phishing, weak security policies (too many admins, unchecked file uploads) and data leaks from misconfiguration.
Put together, the common WordPress security issues are:
| Weak point | Why it matters | What fixes it |
|---|---|---|
| Outdated plugins and themes | Most new vulnerabilities are in plugins, and attacks start within hours | Automatic updates, fewer plugins, delete unused ones |
| Abandoned or nulled plugins | No patch will ever come; pirated copies may ship with malware | Replace them; only install from trusted sources |
| Weak or reused passwords | Bots try leaked and common passwords on wp-login.php and xmlrpc.php |
Unique passwords, two-factor authentication for every admin |
| Too many admins | Every admin account is a way in | Least privilege; remove old accounts |
| Writable files and dashboard file editing | A stolen login can change PHP code from the browser | Tight file permissions, DISALLOW_FILE_EDIT |
| Infected owner computer | Malware steals SFTP and admin logins | Antivirus, SFTP instead of FTP |
How to prevent another hack
The WordPress.org hardening and brute-force guides recommend:
- Keep everything updated and turn on automatic updates. Older versions of WordPress do not get security fixes.
- Use long, unique passwords, do not use the username “admin”, and turn on two-factor authentication for all administrators. WordPress core does not include it, so it needs a plugin, single sign-on or an identity provider.
- Limit login attempts at the edge (a web application firewall or CDN) or on the web server, and protect or disable
wp-login.phpandxmlrpc.php. - Turn off the dashboard file editor with
define( 'DISALLOW_FILE_EDIT', true );inwp-config.php. The guide is honest that this will not stop an attacker from uploading files, “but might stop some attacks”. - Lock down file permissions so only
wp-content/is writable where needed, and only you and the web server can readwp-config.php. - Install plugins and themes only from trusted sources, and delete what you do not use.
- Back up regularly, files and database, and store the backups away from the server.
- Choose a host that runs current server software and has reliable backup and recovery.
The guide also calls security through obscurity “generally an unsound primary strategy”: renaming the login page or the table prefix may stop some bots, but it does not replace updates and strong logins.
When a static copy removes most of the attack surface
Prevention is ongoing work, because new plugin vulnerabilities are exploited within hours. For a site that is mostly pages, a blog and a contact form, there is another option: publish a static copy and take WordPress off the public internet.
A static site is a folder of ready-made HTML, CSS, JavaScript and image files, with no PHP, database or login page on the public server. Most attacks in this guide have nothing to hit:
| Attack | Live WordPress site | Static site |
|---|---|---|
| Vulnerable plugin or theme exploited | Possible on every outdated plugin | No plugins run on the server |
Brute force on wp-login.php or xmlrpc.php |
Constant bot traffic | No login page exists |
| Database spam and injected admin users | Possible | No database |
| Malicious PHP uploaded and run | Possible | Files are not executed on the server |
| Stolen registrar, DNS or hosting account | Possible | Still possible |
| Compromised third-party script (chat, analytics, ads) | Possible | Still possible |
| Abuse of forms or server functions you add | Possible | Still possible, on the code you add |
What a static site does not protect
“Much harder to hack” is not the same as “unhackable”. With a static site, the risk moves to a few accounts and services:
- Your domain registrar, DNS provider and hosting account (for example your Cloudflare account). Whoever controls these controls your site. Use unique passwords and two-factor authentication on all of them, and keep the number of people with access small.
- Where the site is built and deployed from: the Git repository, the build service and the computers that can publish. A stolen deploy token can replace the whole site.
- Third-party scripts you embed, such as chat widgets, analytics or ad code. They run in your visitors’ browsers whatever your server is.
- Forms, search and anything dynamic. A static file cannot receive a form post, so forms go to a form service or a small serverless function. That function is code exposed to the internet and needs the usual care: validation, spam protection and rate limits.
- The private WordPress install, if you keep one for editing. It should not be reachable from the internet, but it still needs updates.
Clean first, then copy
A static copy reproduces what the site serves. If you export or migrate a hacked site, injected links and scripts in the pages can come along. Clean the site first using the steps above, confirm Google’s Security Issues report is clear (or your review request is in), and only then make the static copy. Keep every old URL working with redirects, so you do not lose rankings on top of the hack.
When to stay on WordPress
A static site is the wrong choice for a WooCommerce store, a membership site, a site with user accounts or comments, or a site where many people edit content every day and rely on the dashboard. Those need a live WordPress install, kept up to date, ideally with a managed host and a web application firewall. Our Astro vs WordPress comparison covers who should stay in more detail.
Moving to a static site with Beehexa
Beehexa sells a migration service, so we have an interest here. If you would rather not do the move yourself, our AI static website builder service moves WordPress sites to a static Astro site on Cloudflare Workers. AI agents render every page in a real browser, download the images, videos, documents and fonts, keep every old URL and check 100% URL coverage, and compare screenshots with the live site. You review the result on a preview address that search engines do not index, and nothing goes live until you approve it. Forms, site search and stores need a replacement, which we list in the quote. Prices are one-off: a free 3-page sample, Starter at $490 for up to 100 pages, Business at $1,490 for up to 500 pages, and a custom quote above that. We migrate from the site’s public pages, so a hacked site should be cleaned first.
beehexa.com itself is an Astro site on Cloudflare Workers. To do it yourself, see our guide to migrating a WordPress site to a static site and our comparison of free static site hosting.
FAQ
How do I know if my WordPress site has been hacked?
Common signs are Japanese or spam pages under your domain in Google, redirects to other sites, a “This site may be hacked” label, admin users you did not create, or a host suspension. Check the Security Issues report and URL Inspection tool in Search Console, because spam is often hidden from normal visitors.
What should I do first when my WordPress site is hacked?
Write down what you see, take a full backup of the infected site, contact your host, scan your own computer, and change every password: WordPress, hosting panel, SFTP and database. Then clean the site, and change the passwords again once it is clean.
How do I fix the Japanese keyword hack in WordPress?
Google’s guide says to remove unknown Search Console owners, replace .htaccess with a clean copy, reinstall WordPress core, plugins and themes, remove spam URLs from sitemaps, and look for obfuscated PHP code. Then confirm that the spam URLs return Not Found and request a review in the Security Issues report.
How long does it take Google to remove a hacked site warning?
Google says a review in the Security Issues report can take from a few days to a few weeks. Fix every affected page before you request it, and do not send a second request while one is pending.
What are the most common WordPress security issues?
Outdated or abandoned plugins and themes, weak or reused passwords, too many admin accounts, writable files and an infected owner computer. Patchstack found that 91% of the 11,334 new WordPress ecosystem vulnerabilities in 2025 were in plugins, and only 6 were in WordPress core.
Is a static website unhackable?
No. A static site has no plugins, database or login page on the server, which removes most WordPress attacks. Your domain registrar, DNS and hosting accounts, your build and deploy setup, embedded third-party scripts and any form functions can still be attacked, so protect them with strong passwords and two-factor authentication.
Related guides
- How to migrate a WordPress site to a new host, or to a static site
- Astro vs WordPress
- WordPress alternatives
- Free static site hosting compared
- Convert WordPress to a static site: 4 methods compared
Sources (checked 2026-12-06)
- WordPress.org, FAQ My site was hacked: https://wordpress.org/documentation/article/faq-my-site-was-hacked/
- WordPress Advanced Administration, Hardening WordPress: https://developer.wordpress.org/advanced-administration/security/hardening/
- WordPress Advanced Administration, Brute Force Attacks: https://developer.wordpress.org/advanced-administration/security/brute-force/
- WP-CLI, wp core verify-checksums: https://developer.wordpress.org/cli/commands/core/verify-checksums/
- WP-CLI, wp plugin verify-checksums: https://developer.wordpress.org/cli/commands/plugin/verify-checksums/
- WP-CLI, wp core download: https://developer.wordpress.org/cli/commands/core/download/
- WP-CLI, wp user list: https://developer.wordpress.org/cli/commands/user/list/
- WP-CLI, wp user delete: https://developer.wordpress.org/cli/commands/user/delete/
- WP-CLI, wp user session destroy: https://developer.wordpress.org/cli/commands/user/session/destroy/
- WP-CLI, wp config shuffle-salts: https://developer.wordpress.org/cli/commands/config/shuffle-salts/
- WP-CLI, wp db search: https://developer.wordpress.org/cli/commands/db/search/
- Google Search Console Help, Security Issues report: https://support.google.com/webmasters/answer/9044101
- Google (web.dev), Fix the Japanese keyword hack: https://web.dev/articles/fix-the-japanese-keyword-hack
- Google (web.dev), Fix the cloaked keywords hack: https://web.dev/articles/fix-the-cloaked-keywords-hack
- Google (web.dev), Fix the gibberish hack: https://web.dev/articles/fix-the-gibberish-hack
- Google (web.dev), How do I know if my site was hacked?: https://web.dev/articles/how-do-i-know-if-my-site-was-hacked
- Google (web.dev), Top ways websites get hacked by spammers: https://web.dev/articles/top-ways-sites-get-hacked-by-spammers
- Patchstack, State of WordPress Security in 2026: https://patchstack.com/whitepaper/state-of-wordpress-security-in-2026/