WordPress

WordPress Security Headers: 3 to Delete, 5 to Keep (2026)

By , Lead SEO & Co-founder 7 min read
A server rack front at night fitted with a row of eight glowing shield plates, three being removed into a tray and five staying lit in cyan, a laptop on a cart and a crimson light on the main plate

The quickest WordPress security headers upgrade in 2026 is deleting three of them. X-XSS-Protection, Feature-Policy and Expect-CT still sit in thousands of .htaccess files copied from old tutorials, and none of them protects anyone today. One of them can even open a hole in an otherwise safe page.

After the cleanup, five headers are worth keeping. This post covers both lists, the two values most sites have wrong, and the exact .htaccess block to replace them with. If you'd rather have someone check your headers and fix them, the maintenance questionnaire takes a few minutes, and I reply with a plan and a fixed quote within one business day.

What WordPress security headers actually do

A security header is a short line your server sends with each page, before the page itself. It tells the browser rules like "don't let other sites put this page in a frame" or "only ever load this domain over HTTPS". The visitor never sees them. You can see them in your browser's developer tools under Network, or with one command:

Terminal
# Shows the response headers for your homepage. Read-only.
curl -sI https://example.com/

WordPress itself sends almost none of these. They come from your .htaccess file, your host, a CDN (content delivery network, a service like Cloudflare that sits in front of your site) or a security plugin. That's also why sites end up with duplicates: three different places each add their own copy.

The 3 headers to delete in 2026

1. X-XSS-Protection

This header switched on a filter built into old browsers that tried to spot cross-site scripting (XSS, an attack that injects someone else's JavaScript into your page). The filters were removed from modern browsers because they caused more trouble than they stopped.

MDN's reference now warns that X-XSS-Protection can create XSS vulnerabilities in otherwise safe websites. OWASP's HTTP headers guidance says not to set it at all, or to send 0 to switch the old filter off. The protection it promised now comes from a Content Security Policy.

Delete: Header set X-XSS-Protection "1; mode=block"

2. Feature-Policy

Feature-Policy let you switch off browser features like the camera or microphone for your pages. It was replaced by Permissions-Policy, which does the same job with a different syntax. OWASP lists Feature-Policy only as the predecessor.

The old manual-style line looks like geolocation 'none'; camera 'none'. The new one looks like geolocation=(), camera=(). Sending both just adds noise, and a browser that understands the new one ignores the old one.

Delete: Header set Feature-Policy "..."

3. Expect-CT

Expect-CT asked browsers to check that your SSL certificate had been publicly logged. MDN marks it as deprecated, and notes that Chromium deprecated Expect-CT in version 107 because it now enforces that check by default. Only Chromium-based browsers ever read it.

Delete: Header set Expect-CT "..."

While you're there, if you find Public-Key-Pins, delete that too. OWASP's advice is blunt: do not use it. Pinning a certificate wrongly could lock your own visitors out for months, which is a strange thing to pay for.

Two values most sites have wrong

These headers are worth keeping, but the values in older templates need fixing.

Referrer-Policy "no-referrer-when-downgrade"

The Referer header (yes, it's misspelled in the standard) tells the next site where the visitor came from. MDN explains that no-referrer-when-downgrade sends the full URL, including the path and query string, to any other HTTPS site. On a WordPress site, that can include search terms, form step parameters and campaign tags.

The standard's default changed to strict-origin-when-cross-origin in late 2020, and modern browsers follow it. That value sends only your domain to other sites. Setting it explicitly is what OWASP recommends. Your analytics still sees full referrers from your own pages.

Header append on X-Frame-Options

Most old templates say Header always append X-Frame-Options SAMEORIGIN. Apache's mod_headers documentation explains that append adds to any existing header with a comma. If your host or a plugin already sends X-Frame-Options, you get two values in one header. At best that's clutter. If the values differ (say DENY from the host and SAMEORIGIN from you), you're relying on each browser to settle the conflict. Use set, which replaces instead of adding.

The same documentation explains why always matters: without it, headers can be missing from redirects and error pages.

The 5 WordPress security headers worth keeping

Header Value I'd start with What it does What it can break
Strict-Transport-Security max-age=300, then raise Forces HTTPS in the browser for your domain Visitors on any subdomain still on plain HTTP, if you add includeSubDomains too early
X-Content-Type-Options nosniff Stops the browser guessing file types Very rarely, a file your server labels with the wrong type
X-Frame-Options SAMEORIGIN Stops other sites showing your pages in a frame (clickjacking) A partner site that embeds your pages
Referrer-Policy strict-origin-when-cross-origin Sends only your domain to other sites Nothing you'd notice
Permissions-Policy camera=(), microphone=(), geolocation=() Blocks access to those browser features A store locator or video form that needs them

A note on Permissions-Policy: MDN lists it as limited availability, because not every major browser honors it yet. It's still worth sending. Browsers that understand it enforce it, and the others ignore it harmlessly.

The sixth header, Content Security Policy, is the most powerful and the one most likely to break your site. It gets its own post: rolling out a CSP in report-only mode first.

HTTP security headers in .htaccess: the replacement block

Remove the old header lines from .htaccess, then add this above # BEGIN WordPress:

.htaccess / Apache
# WordPress security headers, Apache 2.4 or LiteSpeed. Replaces older header blocks.
# "always" sends them on redirects and error pages too. "set" avoids duplicates.
# Could break: frames of your pages on other sites (X-Frame-Options) and any feature
# that needs camera, microphone or location (Permissions-Policy). Remove what you need.
<IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=300"
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
    Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"

    # Hide the PHP version. PHP-FPM sets this in the "always" table, so unset both.
    Header always unset X-Powered-By
    Header unset X-Powered-By
</IfModule>

Then raise HSTS (HTTP Strict Transport Security) in steps. Browsers remember it for the full max-age, so a mistake sticks around just as long. Go from 300 (five minutes) to 86400 (a day) after a week, then to 31536000 (a year). Add includeSubDomains only when every subdomain works over HTTPS. The preload flag submits your domain to a list built into browsers, and hstspreload.org warns that removal from that list is slow, so I leave it off for most small business sites.

Notice there's no env=HTTPS on the HSTS line. Older templates added it so the header was only sent over HTTPS. Behind Cloudflare or a load balancer, Apache often sees the request as plain HTTP, so the header was never sent at all. Browsers already ignore HSTS on plain HTTP, so the condition adds risk and no benefit. HSTS also assumes your HTTP-to-HTTPS redirect is clean, which I cover in the guide to forcing HTTPS and www in one hop.

If the site shows a 500 error after saving, mod_headers probably isn't loaded and something outside the <IfModule> wrapper is using Header. The .htaccess 500 error guide shows how to find the line in under a minute.

How to check the result

Run the curl -sI command from earlier and look for each header exactly once. Then try securityheaders.com, a free scanner that grades your headers from A+ to F.

Treat the grade as a checklist, not a score to chase. You can get an A with a Content Security Policy full of 'unsafe-inline' and wildcards, which looks great on the report and stops very little. A B with honest headers beats an A+ with a CSP that allows everything.

Final thoughts

Most WordPress sites don't need more headers. They need fewer, with correct values, set once in one place. Delete the three dead ones, fix Referrer-Policy and the append habit, and add the five that still work. That's a 15-minute job with a backup in hand.

The full file, with these headers plus directory and file protection, is in my Apache 2.4 .htaccess security template. And if you'd like the headers checked again after every host or plugin change, that's part of my monthly WordPress maintenance.

WordPress security headers FAQs

Should I still use X-XSS-Protection on WordPress?

No. Modern browsers removed the filter it controlled, and MDN warns the header can create cross-site scripting problems on pages that were otherwise safe. OWASP recommends leaving it out or sending a value of 0. If a plugin or your host adds it, that's harmless in practice, but don't add it yourself. A Content Security Policy is the modern replacement.

Where should I add security headers in WordPress?

In one place only. On Apache or LiteSpeed hosting, .htaccess is the simplest. On Nginx, they go in the server configuration. On Cloudflare, you can set them with its rules for modifying response headers. Check your current headers with curl -sI first, because many hosts and security plugins already send some, and adding them twice can cause duplicates.

What is the difference between Feature-Policy and Permissions-Policy?

They do the same job: switching off browser features like the camera, microphone or location for your pages. Permissions-Policy is the newer name with a new syntax, such as camera=() instead of camera 'none'. Feature-Policy is the old version and can be deleted. Not every browser enforces Permissions-Policy yet, but sending it does no harm.

Do security headers help SEO?

Not directly. Google doesn't rank pages higher for having them. HTTPS does matter, and HSTS helps make sure visitors always land on the HTTPS version. The real value is protecting visitors and your forms from clickjacking and data leaks. A hacked site loses rankings fast, so prevention helps SEO the indirect way.

Can security headers break my WordPress site?

Most of them can't. X-Content-Type-Options and Referrer-Policy rarely affect anything. X-Frame-Options blocks other sites from framing your pages, HSTS can lock out subdomains without HTTPS, and Content Security Policy can break scripts, forms and tracking if you skip the report-only phase. Add them one at a time and test the pages that make you money first.

Want me to look at your headers? Send the site through the questionnaire and I'll come back with what I'd keep, delete and change.

Want a second pair of eyes on your site?

Tell me what's going on in the wordpress maintenance questionnaire. I reply with a plan and a fixed quote within one business day.

Starting at $250/mo Start the questionnaire