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