WordPress Security 2027: Stop AI Bot Attacks

WordPress runs 38.2% of all websites, and 57.2% of the sites whose content management system is known, according to W3Techs in December 2026. With that reach, a flaw in one popular plugin is worth scanning for across millions of sites, and automated scanning now moves faster than most update routines.

This guide is for the people who answer for a WordPress site: owners of company and e-commerce sites, IT managers and the agencies that maintain them. It covers how the attacks work, how quickly new flaws are exploited and a defense plan you can apply in order, with the settings that matter and a way to check each one.

Why AI Changes Bot Attacks

Imperva's 2026 Bad Bot Report found that automated traffic made up more than 53% of all web traffic in 2025, up from 51% the year before, while human activity fell to 47%. The report also describes AI agents that retrieve data, run workflows and complete transactions through the same interfaces as people, which blurs the line between legitimate and malicious traffic. On a WordPress site that shows up as:

  • login attempts and form submissions that imitate real visitors,
  • crawlers that read pages and adapt their requests instead of following a fixed script,
  • traffic spread over residential IP addresses that look like ordinary users,
  • newly published plugin vulnerabilities tested across thousands of sites within hours.

None of these techniques is new. Automation makes them cheaper to run at scale. The same report found that 27% of bot attacks targeted API endpoints in 2025. That matters for WordPress, where the REST API and XML-RPC are switched on by default.

Not every bot is hostile. Search engine crawlers, uptime monitors and the crawlers of AI assistants all visit the same pages as the attackers. The job in 2027 is not to block automation. It is to tell the bots you want from the bots you do not, and to make the rest expensive.

How Fast Flaws Are Exploited

Patchstack's State of WordPress Security in 2026 counted 11,334 new vulnerabilities in the WordPress ecosystem in 2025, a 42% increase on 2024. Its exploitation figures come from the attacks that its own protection rules observed from the moment each flaw was disclosed. Several findings decide how a site should be maintained:

  • Fixes often come late. 46% of the vulnerabilities did not receive a fix from the developer in time for public disclosure.
  • Exploitation starts within hours. Patchstack tracked the flaws that drew about 95% of the exploitation activity it saw for 2025 disclosures. About half of these high-impact flaws were attacked within 24 hours, and weighted by attack volume, the median time to the first attack was 5 hours.
  • More flaws suit mass attacks. Patchstack rated 1,966 of the new vulnerabilities (17%) as likely to be exploited in automated mass attacks, and the number of highly exploitable vulnerabilities rose 113% year on year.
  • Premium components are a blind spot. Premium and freemium plugins and themes made up 29% of the valid reports Patchstack received (1,983 reports), and it rated 76% of the flaws found in them as exploitable in real attacks: 59% in automated mass attacks and 17% in targeted ones.
  • Broken access control led the attacks. It was the most exploited class. These flaws are specific to WordPress, because they concern who may call which function, and in a separate Patchstack test, hosting firewalls blocked WordPress-specific attacks least often.

The conclusion is uncomfortable: a weekly update routine is too slow for the most dangerous flaws, and some flaws have no update at all on the day they become public. Fast patching still matters, but it has to be combined with fewer components, protection in front of the site and the ability to recover.

Where Sites Get Hit

According to the same Patchstack report, 91% of the new vulnerabilities were in plugins and 9% in themes, while only 6 low-priority issues were reported in WordPress core. Core still needs prompt updates: WordPress 7.1.5, released on 18 November 2026, fixed ten security issues, and the WordPress project recommended updating sites immediately. Bots go where the flaws are:

  • Login pages: credential stuffing and brute force against wp-login.php and xmlrpc.php.
  • Outdated plugins and themes: scanners try known flaws on every site they find.
  • Access control flaws: requests from low-privilege accounts, such as customers or subscribers, that reach functions meant for administrators.
  • Forms and checkouts: spam, fake sign-ups and payment card testing on WooCommerce stores.
  • User enumeration: author slugs collected from author archives and the REST API, which often match login names, to sharpen login attacks.
  • Scraping: crawlers copying pages, prices and product data at scale.

Bot Signs in Your Logs

Many attacks leave traces in the web server's access log before they succeed.

A one-line count of the busiest login attackers on a typical Linux server:

Shell
grep "POST /wp-login.php" /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head

If a handful of addresses send hundreds of login attempts, the rate limits in step 3 below are overdue. The count covers only the current log file, and behind Cloudflare or another proxy the first field is the proxy's address unless nginx restores the visitor's address with its real IP module.

Every signal in the log also has an innocent explanation, so confirm it before you block anyone:

Signal in the LogInnocent ExplanationCheck Before Acting
Bursts of POST requests to wp-login.php or xmlrpc.phpStaff behind one office address, or an app that uses XML-RPCFailed logins in your security plugin for the same period
Requests for ?author=1 or /wp-json/wp/v2/usersThemes, feeds and SEO tools read author pagesThe same address trying logins soon after
Series of 404 errors for plugin files you do not haveBroken links in an old theme or sitemapPaths that match known vulnerable plugins, fast and from one source
Heavy anonymous POSTs to admin-ajax.phpForms, carts and search in your theme use itOne action called far more often than your traffic explains
Many small failed payments in a short timeAn outage at the payment gatewayDecline reasons in the gateway that point to card testing
Visitors that call themselves GooglebotReal Google crawlersThe DNS check in step 5 below

Defense Plan for 2027

Work through the steps in order. The first three close the ways in listed above; the rest limit the damage when something gets through. Test each change on a staging copy or at a quiet hour, and keep the previous configuration ready to restore.

1. Patch and Prune Plugins

WordPress has offered automatic updates for plugins and themes since version 5.5. Turn them on for the components you trust, and review the rest at least weekly. When an advisory names a component you run, let the vendor's response decide the next step:

Advisory StatusWhat to Do
Fixed version availableUpdate, the same day for flaws rated high priority
No fix yet, mitigation publishedApply the mitigation or a firewall rule for the flaw, then watch for the fix
No fix and no mitigationRemove the component, or block the vulnerable request at the server
WordPress core security releaseUpdate core, as the WordPress project advised for 7.1.5
  • Keep an inventory of every plugin and theme, its version, its vendor and why the site needs it.
  • Delete deactivated plugins, and themes you do not use. Keep the active theme, its parent if it is a child theme, and one current default theme as a fallback, which the Site Health theme check looks for. On multisite, check network-wide use first.
  • For premium components, subscribe to the vendor's security notices and keep the license active, because their updates come from the vendor, not from WordPress.org.

Deactivating a vulnerable plugin is not always enough, because its files can still be requested directly. Remove it, or block the request.

2. Leave PHP 8.2

PHP releases receive security fixes for a fixed period. According to php.net, PHP 8.2 receives security fixes until 31 December 2026, PHP 8.3 until 31 December 2027 and PHP 8.4 until 31 December 2028. After that date php.net ships no more fixes for the branch. Some Linux distributions keep patching their own PHP packages for longer, so check what your host actually runs and who supports it.

WordPress itself recommends PHP 8.3 or greater, MariaDB 10.11 or greater or MySQL 8.4 or greater, and HTTPS. Test the upgrade on a staging copy first: log in, publish a post, run a test checkout and read the PHP error log. After the switch, confirm the version the site really runs under Tools → Site Health → Info, because the command line can use a different PHP than the web server.

3. Lock Down Logins

  • Require two-factor authentication for every administrator and editor. WordPress core does not include it. The Two Factor plugin adds it per user but has no setting to require it for a role, so either use a plugin that enforces it or check each privileged account's profile.
  • Limit login attempts and slow down repeated failures.
  • Disable XML-RPC if nothing you use needs it. Jetpack connects to WordPress.com through it, and some apps and publishing tools still use it.
  • Keep the admin area off the open internet: allow it only from known networks or behind a client certificate. Leave admin-ajax.php reachable, because themes and plugins call it for visitors who are not logged in.
  • Do not use "admin" as a username, and stop exposing usernames through author archives.
  • Give each integration its own user account with only the role it needs, and an application password on that account, available since WordPress 5.6. An application password acts with its user's permissions, and you can revoke one without touching the others.

On an nginx server, the web server can rate-limit the login page and close XML-RPC before a request reaches PHP. The example below uses Debian and Ubuntu paths; adjust the PHP-FPM socket to your version:

Nginx
# In the http block: an average of 5 requests per minute per client address
limit_req_zone $binary_remote_addr zone=wplogin:10m rate=5r/m;

# In the WordPress server block
location = /wp-login.php {
    limit_req zone=wplogin burst=3 nodelay;
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}

# Leave this block out if Jetpack or another service needs XML-RPC
location = /xmlrpc.php {
    deny all;
}

The limit counts every request to the login page, including loading the form, and the burst lets a few extra requests through at once. Behind a proxy or CDN, restore the visitor's address first, or all visitors share the proxy's limit. Run nginx -t before reloading, then log in once to confirm that a real user still gets through.

4. Add a Firewall (WAF)

A web application firewall (WAF) at the edge or in the web server filters known exploit patterns before they reach PHP; a firewall plugin works inside WordPress, after PHP has started. Add rate limits for wp-login.php and xmlrpc.php, and block requests that probe for files your site does not have. Limit REST API routes only where you see abuse, and test the block editor and checkout afterwards, because both depend on the REST API.

If you run your own WAF, the open-source OWASP Core Rule Set has a WordPress rule exclusion plugin that reduces false alarms on standard WordPress features; plugins with their own forms may need further tuning. Managed WAFs and security plugins can also apply virtual patches: rules written for one specific vulnerability that block it before the vendor's fix arrives.

Know the limits. In a Patchstack test across 18 hosting providers, the hosts' defenses blocked 25.89% of exploit attempts on average, and WordPress-specific vulnerabilities were the least blocked. A WAF reduces risk; it does not replace updates and fewer plugins. Ask your host which of its rules cover the plugins you actually run.

5. Manage Bots

robots.txt states your preferences to crawlers that follow it; it is not access control. Anyone can put "Googlebot" in a user agent string, so check the address instead. Google's guide to verifying its crawlers gives two methods:

  1. Run a reverse DNS lookup on the address, then a forward lookup on the name it returns, which must give back the original address. For Googlebot the name ends in googlebot.com; Google's other crawlers and fetchers resolve to google.com or googleusercontent.com names.
  2. Compare the address with the IP ranges Google publishes for each type of crawler.

AI crawlers can be managed separately. OpenAI documents three agents with different rules:

AgentWhat It Doesrobots.txt
GPTBotCrawls content that may be used to train OpenAI's modelsDisallow it to keep content out of training
OAI-SearchBotCrawls for the search features of ChatGPTAllow it to appear in ChatGPT search answers; opted-out sites can still appear as navigational links
ChatGPT-UserVisits a page when a ChatGPT user asks for itThe rules may not apply, because a person started the request

A site that wants to stay out of model training but remain visible in ChatGPT search could use:

robots.txt
User-agent: GPTBot
Disallow: /

User-agent: OAI-SearchBot
Allow: /

Allowing OAI-SearchBot permits crawling; it does not guarantee that a page appears. A request whose user agent names a known crawler but whose address fails verification is not that crawler, and it can be rate-limited or blocked at the server.

6. Harden the Server

Run a supported PHP version, set strict file permissions and disable file editing in the dashboard. The official WordPress hardening guide covers the basics. Two lines in wp-config.php close common gaps:

PHP
define( 'DISALLOW_FILE_EDIT', true );
define( 'FORCE_SSL_ADMIN', true );

Also send security headers such as Content-Security-Policy and Strict-Transport-Security, keep the database user limited to the site's own database, and make sure backups and old copies of the site are not stored inside the public web folder.

In the code above, the first line removes the plugin and theme file editors from the dashboard. The second forces HTTPS for logins and the admin area. It needs a working certificate, and behind a proxy WordPress must see that the request arrived over HTTPS, or the admin area can end up in a redirect loop. Add Strict-Transport-Security once the whole site works over HTTPS, and add includeSubDomains only when every subdomain does too. Try Content-Security-Policy in report-only mode first, because a strict policy can break checkout and analytics scripts.

7. Monitor and Back Up

  • Watch for changed files and alert on new administrator accounts.
  • Keep encrypted, off-site backups, and keep more than one generation.
  • Restore a backup to a separate test copy every quarter. Record the backup's time, how long the restore took, and whether login, publishing and a test checkout work there. On a store, turn off outgoing email and live payments on the copy first.
  • Keep server and application logs long enough to investigate an incident that is found weeks later.
  • Write down who does what when a site is compromised: isolate, preserve evidence, clean, patch, rotate passwords, restore.

First Hour After a Hack

  1. Isolate the site at the host or CDN and serve a static maintenance page, so visitors and search engines do not receive malicious content. A maintenance plugin is not enough, because the compromised code keeps running.
  2. Copy the files, the database and the logs, with their timestamps, before you change anything; you will need them to find the way in.
  3. From a clean device, change the passwords for hosting, the control panel, SFTP, the database and administrator accounts, and replace the security keys in wp-config.php, which ends every logged-in session.
  4. Note who created each unknown administrator account and when, then remove it. Check scheduled tasks and the must-use plugins folder for code you did not install.
  5. Replace WordPress core, plugins and themes with clean copies from their official sources. Restore content from a backup that predates the first sign of compromise, and on a store, reconcile the orders and refunds placed since that backup.
  6. Close the hole that was used, change the passwords again, then watch the site and its logs closely for the following weeks.

The WordPress FAQ for hacked sites also covers scanning the site and your own computer, and working with your host.

Maintenance Calendar

A suggested schedule, based on the Patchstack figures above:

TaskHow OftenWhy
Install security updates for plugins and themesSame day for high-priority fixesAbout half of the most-exploited flaws of 2025 were attacked within 24 hours
Check a firewall rule or virtual patch for flaws without a fixWhen a flaw is disclosed46% of vulnerabilities had no developer fix at public disclosure
Remove plugins and themes you do not useMonthly91% of new vulnerabilities were in plugins and 9% in themes
Review premium plugins and their update sourceQuarterlyPremium and freemium components made up 29% of the valid reports Patchstack received
Review administrator and shop manager accountsMonthlyBroken access control was the most exploited class in 2025
Check the PHP versionBefore 31 December 2026 for PHP 8.2 sitesPHP 8.2 security support ends on that date
Restore a backup on a test copyQuarterlyOnly a timed restore shows how much you can recover and how fast
Read the access log for login bursts and 404 scansWeeklyScanners and credential stuffing show up in the log before they succeed

Quick Security Check

  1. Update WordPress core, plugins and themes, then delete inactive plugins and spare themes, keeping one default theme.
  2. Check which PHP version the site runs in Site Health, and plan the move if it is 8.2 or older.
  3. Turn on two-factor login for every administrator, and confirm that each one has set it up.
  4. Check that xmlrpc.php is blocked or rate-limited, unless Jetpack or another service needs it.
  5. Confirm the site forces HTTPS and sends a Strict-Transport-Security header.
  6. List the administrator accounts, note when unknown ones were created, then remove them.
  7. Find the date of your last successful test restore, and schedule one if there is none.

Frequently Asked Questions

Is WordPress secure enough for a business site in 2027? Yes, when it is maintained. Patchstack counted only 6 low-priority issues in WordPress core in 2025, while 91% of the 11,334 new vulnerabilities were in plugins and 9% in themes. Most of the risk sits in the components you add and in how quickly you update them. Core still ships security releases, such as 7.1.5 in November 2026, so keep it updated too.

How quickly should I install WordPress security updates? Install fixes for high-priority flaws the same day. Among the most-exploited WordPress flaws of 2025, about half were attacked within 24 hours, and weighted by attack volume, the median time to the first attack was 5 hours. A weekly update window is too slow for these, so turn on automatic updates for trusted plugins and keep a firewall rule ready for flaws that have no fix yet.

Which PHP version should a WordPress site run in 2027? PHP 8.3 or newer. According to php.net, PHP 8.2 receives security fixes until 31 December 2026, PHP 8.3 until 31 December 2027 and PHP 8.4 until 31 December 2028, and WordPress itself recommends PHP 8.3 or greater. Test the upgrade on a staging copy, because an old plugin or theme can fail on a new PHP version.

Do I need a web application firewall for WordPress? For any site with logins, forms or a shop, yes, as one layer. A firewall can block known exploit patterns and rate-limit wp-login.php and xmlrpc.php, but in Patchstack's test of 18 hosting providers the hosts' defenses blocked only 25.89% of exploit attempts on average. Check which rules cover the plugins you run, and keep patching, because no firewall replaces updates.

Should I block AI crawlers such as GPTBot? Decide per crawler. OpenAI documents GPTBot, which collects content that may be used to train its models, and OAI-SearchBot, which crawls for ChatGPT search, as separate robots.txt settings. You can disallow GPTBot and still allow OAI-SearchBot. Requests made for a person, such as ChatGPT-User, may not follow robots.txt.

What should I do first if my WordPress site is hacked? Isolate the site at the host or CDN, then copy the files, the database and the logs before you change anything. From a clean device, change every password and key, remove unknown administrators, replace core, plugins and themes with clean copies, and restore content from a backup made before the compromise. Close the hole that was used and change the passwords again before you bring the site back.