PHP snippet · Security

Hide the WordPress version

Removes the generator meta tag, the feed version, and the core version query string that tell scanners which exploits are worth trying.

About this php snippet

WordPress announces its exact version in a meta tag, in every feed, and as a version parameter on core scripts and styles. Automated scanners read it to decide which exploits are worth firing at you, and most of them only fire on a match.

Be clear about what this is: obscurity, not security. It buys nothing on its own and is no substitute for keeping WordPress updated. What it does buy is that your site stops answering the first question every drive-by scan asks, which takes you out of a lot of automated noise.

What it does

  • Removes the generator meta tag from the page head
  • Empties the generator string in RSS and Atom feeds, which is the copy most snippets forget
  • Strips the version parameter from core scripts and styles when it matches the WordPress version

Good to know

  • Plugin and theme versions are deliberately left alone. Stripping those would break their cache busting and serve visitors stale files after an update.
  • The trade-off on core assets is that they lose their version parameter, so a browser or CDN may hold a cached copy a little longer after a WordPress update
  • A determined attacker can still fingerprint a version from other signals. This is one small layer on top of updates, strong passwords, and two-factor, not a replacement for any of them.

More php snippets

Your EMCP guide

Answers from our docs

YOUR CHAT, YOUR CHOICE

Before we chat

MSR Builds processes your question and up to four recent messages on our server to answer from the EMCP docs. AI is optional and needs your separate permission.

The chat is kept in this page's memory, not saved as a conversation in our database or browser storage. Our hosting and security services process connection information, such as your IP address, to prevent abuse.

Cloudflare Turnstile checks your browser and connection to prevent automated abuse when you send a question. No login is required.

Please leave out personal, sensitive or confidential information, passwords and API keys.

You can withdraw consent and clear this page's chat at any time. This cannot undo a request already sent or erase provider/security records.

Chat privacy, retention & your rights ↗ · Privacy contact

Starting chat consents to this processing. You can browse our docs without using the chat.