Security

WordPress hacked? How to fix it, remove malware and stop it coming back (2027 guide with real cases)

8 min read By Cloud Ninza

Redirects to gambling sites, strange pages in Google, a host warning — here is how to confirm a WordPress hack, clean it properly, recover your rankings and lock the site down, with real cases from sites we cleaned in 2026.

In short If your WordPress site is hacked: take a full backup first, change every password (hosting, WordPress admins, database, FTP/SSH, email), replace WordPress core with a fresh copy, reinstall every plugin and theme from the official source, delete unknown PHP files and admin users, check .htaccess and wp-config.php for injected code, then ask Google to review the site in Search Console. Most hacks start with outdated plugins or stolen passwords, so update everything and keep a host with server-level protection and restorable backups.

Why WordPress sites get hacked

WordPress runs about 43% of all websites according to W3Techs, so attackers automate their tools around it. Most attacks are not personal: bots scan millions of sites for known weaknesses and try leaked passwords around the clock. Security researchers at Patchstack, who publish yearly reports on WordPress vulnerabilities, consistently find that the vast majority of new vulnerabilities — well over 90% — are in plugins, with only a tiny share in WordPress core itself.

In practice almost every hacked site we see falls into one of four causes: an outdated plugin or theme with a known hole, a nulled (pirated) premium plugin that came with a backdoor built in, a weak or reused admin password, or files left in public folders — old backups, database dumps and copies of wp-config.php — that hand attackers the keys.

Signs your WordPress site is hacked

Some hacks are loud; the dangerous ones are quiet. Check for these:

  • Visitors (especially on mobile or from Google) are redirected to gambling, pharmacy, adult or 'you won a prize' pages.
  • Google shows strange titles for your site — Japanese or Indonesian text, casino or loan keywords — when you search site:yourdomain.com.
  • Chrome or Google Search shows 'This site may be hacked' or a red 'Deceptive site ahead' warning.
  • New admin users you did not create, or your own admin password suddenly stops working.
  • Unknown PHP files with random names in the site folders (for example wp-util-x7k2.php or files inside wp-content/uploads).
  • Your host suspends the site, or your mail is suddenly refused because the server sent spam.
  • The site becomes very slow, with server load far above normal while visitor numbers have not changed.

Real cases: what we found on hacked sites in 2026

In October 2026 we moved dozens of websites to Cloud Ninza from another hosting company and checked every file before going live. Several sites had been compromised for months without their owners knowing. These cases show what hacks really look like (client names left out):

Case 1: Googlebot cloaking to a gambling page

A doctor's WordPress site looked perfectly normal to visitors. But when Google's crawler visited, the server showed it a gambling page instead — a trick called cloaking, done through a fake wp-admin/index.html file and a hidden folder of spam pages. The owner only noticed because the site's search results looked wrong. We copied only clean files, replaced WordPress core, removed a dropper file named like a WordPress utility, deleted exposed wp-config backup files and set new admin passwords.

Case 2: a remote-code loader in a static site

A dental clinic's simple HTML site carried an upload.php file that let anyone on the internet run code on the server, plus an abandoned WordPress install in a subfolder full of SEO-spam scripts and fake Google verification files. The live site was static, so we moved only those static pages and left the abandoned WordPress and its database out entirely.

Case 3: planted droppers and a web shell

Across the sites we moved, we quarantined 21 planted PHP backdoors — files with random suffixes, fake cache files that accepted commands from the internet, and droppers hidden in upload folders. A rule we now follow on every move: never copy a PHP file with a random-looking name without reading it first.

Case 4: a brute-force attack that slowed every site

In November 2026 a botnet hammered xmlrpc.php and wp-login.php on WordPress sites we host, pushing one server's load far above normal. We blocked xmlrpc.php at the web server for every site, added per-visitor rate limits and automatic 24-hour bans for repeated failed logins, and turned on a page cache for every WordPress site. Load returned to normal, and every WordPress customer is protected by those rules today.

First hour: what to do immediately

Stay calm and work in this order. Speed matters, but deleting things in panic destroys the evidence you need to find how they got in.

  • 1. Take a full backup of files and database as they are now, and keep it separately — it is evidence, not something to restore.
  • 2. Put the site in maintenance mode, or ask your host to restrict it, if visitors are being redirected to harmful pages.
  • 3. Change passwords from a clean device: hosting account, every WordPress administrator, database user, SFTP/SSH and email accounts on the domain.
  • 4. Check Users in wp-admin and delete any administrator you do not recognise.
  • 5. Tell your host. A good host can see server logs, which files changed and when, and whether other sites were affected.

Step-by-step: how to clean a hacked WordPress site

Cleaning means replacing everything that should not change and inspecting everything that should. Follow these steps:

  • 1. Note the exact WordPress, theme and plugin versions, then download a fresh copy of the same WordPress version from wordpress.org.
  • 2. Replace wp-admin and wp-includes completely with the fresh copies, and replace the root WordPress files except wp-config.php.
  • 3. Delete every plugin and theme folder and reinstall them from wordpress.org or the vendor. Delete any nulled premium plugin for good.
  • 4. Search wp-content (especially uploads) for .php files — uploads should contain images and documents, not code. Remove anything you cannot explain.
  • 5. Open wp-config.php and .htaccess and remove anything unusual: long encoded strings, eval(), base64_decode(), or redirect rules you did not add.
  • 6. In the database, check wp_options (siteurl, home and active_plugins) and search posts for injected <script> tags or hidden links.
  • 7. Generate new WordPress security keys (salts) in wp-config.php, which signs every user out everywhere.
  • 8. Delete old backups, .sql dumps, .zip archives and wp-config copies from public folders.
  • 9. Scan again, then watch the site's files and traffic for a week to make sure nothing comes back.

If you have a clean backup from before the hack, restoring it can be faster — but only if you know when the hack happened, and you must still update everything and change every password, or the attacker walks back in through the same hole. On Cloud Ninza you can restore any of the last 30 days' backups yourself (files, database or both) and keep the current version saved alongside for comparison.

Recover your Google rankings after a hack

Hacks hurt rankings in two ways: Google may show a warning on your results, and spam pages created by the attacker may still be indexed. To recover:

  • Open Google Search Console → Security & Manual Actions. If there is a security issue, fix it, then click Request review and describe what you cleaned.
  • Search site:yourdomain.com to find spam pages. Make sure they now return 404 or 410, then use Removals for the worst ones.
  • Submit a fresh sitemap so Google recrawls your real pages.
  • Check Bing Webmaster Tools too — Bing powers ChatGPT search and Copilot.
  • Watch Performance in Search Console for two to four weeks; rankings usually return once the warning is lifted.

How to stop WordPress being hacked again

Prevention is mostly habits plus the right hosting. Compare a typical unprotected setup with a protected one:

RiskUnprotected siteProtected site
Outdated plugins and themesUpdated 'when someone remembers'Updated weekly; unused ones deleted
Nulled premium pluginsInstalled to save moneyNever — only official sources
Admin passwordsShort, reused, shared by emailLong, unique, in a password manager, two-step login
Brute-force on login and xmlrpc.phpUnlimited attemptsxmlrpc blocked, rate limits, automatic bans
Backups and dumps in public foldersDownloadable by anyoneBlocked from the web, stored off-site
File editing in wp-adminEnabledDISALLOW_FILE_EDIT turned on
Isolation between sitesOne hacked site infects its neighboursEach account isolated from the others
BackupsNone, or only on the same serverTwice a day, off-site, restorable in minutes

How Cloud Ninza protects WordPress sites

Everything we learned from cleaning hacked sites is built into our WordPress hosting, on every plan:

  • xmlrpc.php blocked, per-visitor rate limits and automatic bans for brute-force logins and vulnerability scanners.
  • Downloads of backups, database dumps, archives, logs and wp-config copies blocked on every site.
  • Each hosting account isolated from the others — one account cannot read another's files, apps or database.
  • DDoS protection at the network and web-server level, plus a page cache on every WordPress site.
  • Off-site backups twice a day, kept for 30 days, which you restore yourself from the dashboard.
  • Free SSL, one-click WordPress sign-in from your dashboard, and a password vault for your logins.
  • Help moving an existing WordPress site — we check every file for planted code before it goes live.

Key takeaways

The short version, for anyone skimming:

  • Most WordPress hacks come from outdated plugins, nulled plugins, weak passwords or files left in public folders.
  • Signs include redirects, spam pages in Google, unknown admins, random PHP files and sudden server load.
  • Back up first, change every password, replace core and plugins with fresh copies and remove unknown files.
  • Clean the database, rotate security keys, delete public backups, then request a review in Search Console.
  • Prevent repeats with updates, strong passwords, blocked xmlrpc.php, isolation and off-site backups.
  • Cloud Ninza WordPress hosting from ₹1,788 a year includes these protections and restorable backups.
Host it with us

WordPress Hosting from ₹1,788/year

WordPress on India-hosted cloud servers, installed for you — the latest release or the version your site needs. Latest WordPress or your chosen version · PHP 8.3, 8.4 or 8.5 · Free SSL certificate.

Ready when you are

Hosting from ₹149 a month on servers in India

WordPress, static HTML, PHP, Node.js, Python and Java plans with free SSL and your choice of version. Create your account, pick a plan and pay by UPI, card or netbanking; your hosting is created automatically and you get your login by email, usually within minutes.

Questions

Questions on this topic

How do I know if my WordPress site is hacked?

Look for redirects to spam sites, strange pages when you search site:yourdomain.com, browser or Google warnings, unknown admin users, random PHP files and sudden slowness or high server load.

Can a hacked WordPress site be fixed?

Yes. Replace WordPress core, plugins and themes with fresh copies, remove unknown files and admin users, clean the database, change every password and request a Google review. Most sites recover fully.

Should I restore a backup or clean the site?

Restore a backup only if you know it is from before the hack — and still update everything and change every password afterwards. Otherwise clean the current site.

How do hackers get into WordPress?

Mostly through outdated or nulled plugins and themes, weak or reused passwords, and backup or config files left in public folders.

What is the WordPress redirect hack?

Injected code that sends visitors — often only mobile users or visitors from Google — to spam, gambling or scam sites, while the owner sees a normal site.

What is the Japanese keyword hack?

A hack that creates thousands of spam pages with Japanese text on your domain so they rank in Google. You find them by searching site:yourdomain.com.

How do I remove the 'This site may be hacked' warning?

Clean the site, then in Google Search Console go to Security & Manual Actions and request a review describing what you fixed. Google usually reviews within days.

Will a hack affect my Google rankings?

It can, through warnings and indexed spam pages. Rankings usually recover within a few weeks after a full clean-up and a successful review.

Are nulled WordPress plugins safe?

No. Pirated premium plugins very often contain backdoors. Buy from the developer or use free plugins from wordpress.org.

Does my hosting affect WordPress security?

Yes. Server-level protection, account isolation, blocked sensitive files and off-site backups stop many attacks before WordPress is involved, and make recovery quick.

Does Cloud Ninza help clean or move hacked sites?

When we move a WordPress site to Cloud Ninza we check every file for planted code before it goes live. Request a migration from our quote page and tell us what you have seen.

How often should I back up WordPress?

At least daily, off-site. Cloud Ninza backs up every site twice a day to two off-site locations and keeps 30 days, restorable by you from the dashboard.