Featured image for Remove WordPress Version from Head and Feeds

Remove WordPress Version from Head and Feeds

05/10/2025 · Code Snippets

This code snippet removes the WordPress version number that normally appears in your site’s <head> and in your RSS feeds. By default, WordPress outputs its version, which can make it easier for automated bots or scanners to identify which version of WordPress your site is running.

While hiding the version number isn’t a replacement for keeping WordPress and plugins up to date, it does add an extra layer of privacy.

Think of it as making your site a little less obvious to automated tools that look for known vulnerabilities. It’s a simple, safe tweak that helps harden your site without changing how it looks or works for your visitors.

// Completely remove WordPress version number from <head> and RSS feeds
function wp_remove_version() {
    return '';
}
add_filter('the_generator', 'wp_remove_version');

// Also remove the meta tag from <head>
remove_action('wp_head', 'wp_generator');

🔧 Where to insert this snippet?

Simply add the code to your theme’s functions.php file.

💡 Why Use it?

  • Reduces exposure to automated bots and version-based exploits
  • Clean, safe, and doesn’t affect site functionality
  • Plays well with all modern themes and plugins

Who’s the dev?

Code Snippet by
@mike  •  Mike C.


I’ve been a web designer/developer for 20+ years. "Coffee in, code out." I love tinkering with WordPress, Photoshop, Blender, Bootstrap, and AI. I split my time between France and the Netherlands. When I’m off the clock, I enjoy creating assets and mods for video games like Ark, Cities: Skylines, and The Sims.

alox.co


Join the conversation


You must be logged in to comment.
Login or register for a free account now!
Alox & Co

Login



Not yet a member?

Create your free account today and start a new adventure!

Register