If you manage a WordPress site, you've probably seen "XSS" in a plugin changelog or a security alert and wondered how worried to be. Cross-site scripting is the vulnerability you'll see named most often, and in November 2026 it showed up in WordPress itself: of the 20 security fixes in WordPress 7.1.5, eight were cross-site scripting bugs.

The short answer: WordPress XSS happens when a plugin, theme or WordPress itself lets someone save or slip JavaScript into a page, which then runs in the browser of whoever views it. If that viewer is a logged-in administrator, the attacker's script can act as them, which is how XSS turns into a full site takeover. The defense that matters most is updating every week, because the XSS flaws attackers hit hardest are old ones that already have a fix. A firewall at the edge, fewer plugins and a database-aware cleanup when something does get in cover the rest.

I'm Shane Larrabee, and I've run FatLab, a managed WordPress host, since 2011. Here's how XSS actually works on a WordPress site, the cases worth knowing, how to tell if a site has it, and what stops it.

What Cross-Site Scripting in WordPress Actually Is

Cross-site scripting (XSS) is an injection attack where an attacker gets JavaScript into a page on your site, and visitors' browsers run it as if your site wrote it. Most attacks go after your server or your database. XSS goes after the people looking at your site.

"The page loads just fine. The visitor has no idea there's nefarious activity happening behind the scenes. That's what makes XSS dangerous."

The mechanics are simple. Somewhere on the site, code takes input from outside (a comment, a form field, a URL parameter, a plugin setting, an HTTP header) and puts it back on a page without cleaning it. The attacker sends a script instead of normal text. If the site stores or reflects it as is, the browser can't tell the attacker's code from yours, so it runs it.

What that script can do depends on who loads the page:

  • For a regular visitor: redirect them to a scam or malware page, show a fake login or payment form, or insert spam links that Google will find. This is one way redirect hacks and pharma spam get onto a site.
  • For a logged-in administrator: everything an administrator can do. The script runs inside the admin's own session, so it can create a new admin account, install a plugin or change settings, with no password needed.

That second case is the one that matters. WordPress marks its login cookies so scripts can't read them directly, but an attacker doesn't need to steal the cookie when their script can simply use the admin's browser to do the work. When attackers exploited a LiteSpeed Cache XSS flaw in 2024, that's exactly what they did: the injected script created administrator accounts with names like wpsupp-user (WPScan). It also means two-factor authentication doesn't help here, because the admin already passed it.

XSS is a different animal from SQL injection, which attacks the database, or brute force, which attacks the login. XSS uses your visitors' trust in your site, and your administrators' access to it.

The Three Types of XSS, and Which One Matters

Stored XSS: the one to worry about

The attacker's script gets saved on your site, usually in the database: a comment, a form entry, a plugin setting, a popup's custom code. From then on it runs for everyone who loads the affected page. Nobody has to click anything.

Stored XSS that needs no login to plant is the worst kind. Anyone on the internet can do it, usually with a single automated request, and it hits every visitor, administrators included. When you read a security alert, look for two words: "unauthenticated" and "stored." Together they mean act now.

It's also the hardest to find, because the code lives in database records, not files. Most malware scanners look at files.

Reflected XSS: needs a click

The script rides in a crafted link and is bounced back in the page response, without being saved. It runs once, for whoever clicks. That takes some trickery, like a link in an email, but one click by an administrator is enough. One of the fixes in WordPress 7.1.5 was a reflected XSS in the legacy media library.

DOM-based XSS: never touches the server

Here the page's own JavaScript reads something an attacker controls, like the part of a URL after the #, and writes it into the page unsafely. Browsers don't send that part of the URL to the server, so server logs never see it and a firewall in front of the server can't block it. With the block editor and page builders shipping more and more JavaScript, this matters more than it used to.

Type Where the script lives Who it hits How bad
Stored Saved on the site, usually the database Every visitor to the page, admins included Worst, especially when no login is needed
Reflected In a crafted link Whoever clicks Serious if an admin clicks
DOM-based In the page's own JavaScript Whoever opens the crafted link Serious, and invisible to the server

Three distinct colored streams converging on a single open browser window representing the three types of cross-site scripting attacks

Is XSS Still a Real Threat in 2026?

Yes. Two things are true at once, and both matter.

XSS is one of the two most reported WordPress flaws. Cross-site scripting was the most common vulnerability type Wordfence published in the last quarter of 2025, with 658, and a close second in the first quarter of 2026, with 736, just behind missing authorization checks at 753 (Wordfence Q4 2025 report, Wordfence Q1 2026 report). Across the whole ecosystem, Patchstack counted 11,334 new WordPress vulnerabilities in 2025, up 42% on 2024, which is about 31 a day, and 91% of them were in plugins (Patchstack, State of WordPress Security in 2026). OWASP's 2025 Top 10 files XSS under A05: Injection and counts more than 30,000 XSS CVEs, describing it as high frequency and lower impact than SQL injection (OWASP A05:2025 Injection).

Most of those reports never hurt anyone. A lot of them need an account with editing rights first, and plenty sit in small plugins few sites run. That's why OWASP calls the class lower impact on average. On a WordPress site, though, the average hides the dangerous cases: one unauthenticated stored XSS in a popular plugin, or one script that runs in an administrator's browser, and it's a takeover.

And the dangerous cases are being used. Patchstack's list of the ten vulnerabilities attackers targeted most in 2025, counted from the exploit attempts it blocked on its customers' sites, starts with two XSS flaws:

  1. LiteSpeed Cache (5.7 and older): unauthenticated stored XSS. Fixed in October 2023, published by Patchstack in February 2024 when the plugin ran on more than 4 million sites (Patchstack), exploited to create admin accounts that May.
  2. tagDiv Composer (before 4.2): unauthenticated stored XSS in the companion plugin for the Newspaper and Newsmag themes. Disclosed in September 2023, it was picked up within weeks by Balada Injector, a long-running malware campaign against WordPress sites (Sucuri).

Both were fixed years ago. Attackers were still hammering them in 2025 because enough sites never installed the fix. That's the most useful fact in this whole article: the XSS flaws that get exploited most are not the new ones. They're the old ones on sites nobody updates.

WordPress core isn't exempt

For years the honest line was that WordPress core rarely has serious XSS problems. 2026 complicated that. WordPress 7.1.5, released November 18, fixed 20 security issues, and eight were cross-site scripting. One was an unauthenticated stored XSS via shortcode attributes in comments, which means anyone able to post a comment could plant a script. Fixes went out for every branch back to 4.7 (WordPress 7.1.5 release notes). Two of the twenty, including one of the XSS bugs, were reported by Anthropic, a sign of how AI tools are speeding up how fast bugs get found.

If your site doesn't use comments, turn them off. When a client's site kept triggering spam moderation emails from comment bots, we closed comments entirely. They weren't using them, and closing them removed the problem along with an input field nobody needed.

Why WordPress Sites Get Hit

"FatLab writes secure code, but we can't control every plugin and theme developer."

WordPress gives developers the tools to prevent XSS: functions like esc_html(), esc_attr(), esc_url() and wp_kses() that clean data before it reaches the page (WordPress Developer Resources: Escaping Data). The problem is that every output point in every plugin has to use them correctly, every time. A large plugin has hundreds of places where data reaches the page. Miss one and you have an XSS flaw.

Multiply that by the 60,000 plugins in the WordPress.org directory, plus commercial plugins and themes sold elsewhere, written by everyone from large companies with security teams to one person on weekends. Then add the two habits that turn a disclosed flaw into a hacked site:

  • Slow updates. Patchstack found 46% of 2025's vulnerabilities had no fix available when they were made public, and that about half of the most serious ones were attacked within 24 hours. A site updated monthly sits exposed for weeks at a time. A site never updated is the reason two-year-old XSS bugs topped the 2025 attack list.
  • Deactivated plugins left on the server. Deactivating a plugin stops it from running through WordPress, but its files stay on disk, and some flaws can be reached by calling those files directly. When we reviewed a site this spring before a PHP upgrade, we found a page builder add-on deactivated but still installed, with three unpatched vulnerabilities, two of them XSS. Our recommendation was simply to delete it: the cheapest fix with the most value.

"The real risk isn't that a vulnerability might exist. The real risk is that there may be no one to patch it when a vulnerability is discovered."

Dormant XSS: What We Found in One Site's Database

Stored XSS can outlive the plugin it came in through. Here's a case from our own work.

This summer a site came to us after a breach on another platform. While cleaning it, we found something older than the breach we were there for: 45 database rows left by an attack on Popup Builder, a plugin whose unauthenticated stored XSS flaw (CVE-2023-6000) let any visitor rewrite existing popups (WPScan advisory). Two days after it was published in December 2023, the same Balada Injector campaign started using it, and Sucuri soon found the injection on more than 6,200 sites (Sucuri).

The payload was sitting in the popups' custom JavaScript fields, disguised as eval(atob('...')). Decoded, it loaded a script from an attacker's server. Popup Builder had since been removed from the site, so the code wasn't running. But it was still in the database, and it would have come back to life the moment anyone reinstalled the plugin.

Two lessons from that one:

  1. File scanners don't see it. Our first pass compared files before and after the breach and missed it completely, because it wasn't in a file and it predated the breach. A database-aware scan flagged it, and we then searched every text column in the database to be sure we had all of it.
  2. Removing a vulnerable plugin doesn't remove what it let in. Updating or deleting the plugin closes the door. It doesn't clean up what came through.

How to Tell if Your Site Has Stored XSS

You usually find out from symptoms, not from a scanner:

  • Visitors report redirects or pop-ups you didn't create, often only on mobile or only for first-time visitors, which is why you may not see it yourself.
  • Administrator accounts you don't recognize. Check Users and filter by Administrator. A name like wpsupp-user or wp-configuser is a red flag.
  • A Google Search Console security warning, or a red "Deceptive site ahead" screen in Chrome.
  • Unfamiliar <script> tags in the page source, especially loading from a domain you don't know.

To confirm it, someone has to look in the database: post content, widget and option settings, post meta (where page builders and popup plugins store their settings), and comments. Look for <script, eval(, atob(, String.fromCharCode and long base64 strings. WPScan's advice for the LiteSpeed attacks, for example, was to search one specific option for exactly that kind of string.

Cleaning it up properly takes four steps, in this order:

  1. Close the door. Update or remove the plugin that let it in. Otherwise it comes straight back.
  2. Remove every payload, not just the one you found. These campaigns plant the same code in many places.
  3. Remove anything the script created. Delete rogue admin accounts, check for new plugins and backdoors hiding in plugin folders, and reset passwords and security keys so every existing login session is ended.
  4. Purge every cache, at the CDN and on the server, so visitors stop getting the infected copy of the page.

If that sounds like a lot to do by hand in a database, it is. A professional security audit is the way to know for sure.

A single website form field radiating outward to multiple visitor devices showing how one XSS vulnerability affects many users

What Actually Prevents WordPress XSS

No single measure stops all XSS. Here's what works, in order of how much it does.

1. Weekly updates, tested before they go live

The update is the fix. It removes the vulnerable code. Everything else on this list buys time or limits damage. Weekly updates mean a flaw is closed within days of a fix existing, not weeks or never. We go through why updates have to be tested first in our guide to updating WordPress safely.

2. Fewer plugins, from people who maintain them

Every plugin adds hundreds of places where an XSS bug can hide. Delete what you don't use, don't just deactivate it. Prefer plugins with recent updates, a real company or developer behind them, and a history of fixing reported flaws quickly. Be wary of anything that hasn't been updated in six months. And never install pirated copies of paid plugins: they don't get security updates, and they often arrive with malware already inside.

3. A firewall at the edge, as a safety net

A web application firewall in front of your site, like Cloudflare, blocks requests that look like known attacks before they reach WordPress: script tags in form fields, onerror= tricks, javascript: links and common encodings. It's worth having, and it stops a lot of automated noise.

It is not a wall. In Patchstack's 2025 test of hosting defenses against real WordPress plugin exploits, the defenses blocked only about 12% (Patchstack). Patchstack sells a competing product, so weigh that accordingly, but the reason is real: an exploit written for one plugin can look like an ordinary form submission. A firewall also can't see DOM-based XSS at all, since that never reaches the server. And a security plugin inside WordPress only acts after the request has reached your server, which is part of why we prefer server-level protection over security plugins.

4. Fewer people who can post HTML

A lot of XSS flaws need an account first, contributor or author level, sometimes just subscriber. Give accounts the lowest role they need, remove accounts for people who've left, and don't let the public register for accounts unless the site needs it. Spam registrations are a nuisance, but on a site with an XSS flaw that needs a subscriber account, they're also a way in.

5. Security headers and clean custom code

For code we write ourselves, the rule is WordPress's own: clean data when it comes in, escape it at the exact point it's printed. A Content Security Policy header, which tells browsers to run scripts only from sources you trust, can stop an injected script even when it reaches the page. It's powerful, but hard to do on WordPress: core, themes and plugins all rely on inline scripts, so a strict policy breaks most sites. Treat it as a project for a developer who knows the site, not a setting to switch on.

Three concentric protective barriers surrounding a clean website representing layered security defenses against cross-site scripting

How We Handle It at FatLab

Here's what's in place on the 200+ sites we host as part of our managed WordPress security:

  • Weekly updates on every site. Plugins, themes and core are updated every week. Each update runs on a copy of the site first and gets a visual check, and if the layout changes, a person reviews it before it reaches the live site. That came to 4,659 updates across 138 sites in the three months to November.
  • Cloudflare at the edge. Every production site we host sits behind Cloudflare's enterprise firewall. In one three-day window this November, its managed rules for known exploit patterns matched more than 270,000 requests aimed at our sites.
  • Imunify360 on every server, scanning for malicious files and blocking addresses with a bad track record. It looks at files, not database content, which is why updates and a database-aware cleanup matter for XSS.
  • Cleanup included. If something does get in, we clean it, and we look in the database, not just the files.

None of this is a promise that nothing ever gets through. It's the difference between a site that gets updated when someone remembers and one where it happens every week, with someone accountable for the result. Our overview of how WordPress sites get hacked covers the other threats, and what secure WordPress hosting actually means explains what to look for in a host.

Frequently Asked Questions

What is an XSS attack in simple words?

It's when an attacker gets their own JavaScript onto a page of your website, so it runs in the browser of anyone who views that page. The visitor sees your normal site and trusts it, while the script redirects them, shows them a fake form or, if they're an administrator, quietly uses their access to take over the site.

Is WordPress vulnerable to XSS?

WordPress core is well protected most of the time and includes escaping functions that prevent XSS when developers use them. But it isn't immune: WordPress 7.1.5, released November 18, 2026, fixed eight XSS bugs in core, including one anyone could exploit through comments. Most WordPress XSS comes from plugins and themes, which make up nearly all reported WordPress vulnerabilities.

Which type of XSS is the most harmful?

Unauthenticated stored XSS. "Stored" means the script is saved on the site and runs for every visitor, administrators included. "Unauthenticated" means anyone can plant it, no account needed. The two most attacked WordPress vulnerabilities of 2025, in LiteSpeed Cache and tagDiv Composer, were both this type.

Is XSS still relevant today?

Yes. It's one of the two most reported vulnerability types in WordPress, and attackers are still exploiting XSS flaws that were fixed years ago on sites that never updated. OWASP's 2025 Top 10 still covers it under Injection.

Can Cloudflare stop XSS attacks on WordPress?

It stops many of them. Cloudflare's firewall blocks requests that match known attack patterns before they reach WordPress, which is well worth having. It can't stop all of them: an exploit aimed at one specific plugin can look like normal traffic, and DOM-based XSS never reaches the server at all. Use the firewall as a safety net and keep updates as the real fix.

How do I know if a WordPress plugin is safe from XSS?

No one can promise that, but you can lower the odds. Choose plugins updated in the last few months, from a developer with a track record of fixing reported flaws quickly. Check the plugin's history in a vulnerability database like Wordfence's or Patchstack's. Keep the number of plugins small, and delete the ones you don't use instead of deactivating them.

How worried should I be when a plugin I use has an XSS warning?

Check three things. Does your installed version fall in the affected range? Does the flaw require a login, and at what level? Is a fixed version out? An unauthenticated stored XSS in a plugin you run, with a fix available, means update today. A flaw that needs an administrator account is much lower risk. If there's no fix and the plugin isn't essential, remove it until there is one.

Will updating a plugin remove an XSS infection?

No. The update closes the flaw so no new code can get in, but any script already saved in the database stays there. We've found malicious code from an old popup plugin attack still in a site's database long after the plugin was removed. Cleaning up means finding and removing every payload and anything it created, like rogue admin accounts.

If you'd rather not track this yourself, our WordPress security services page explains what we cover, and our hosting plans show what's included with every site.