How to hide your WordPress version number…completely

Did you know that your WordPress version number is visible to everyone?

As Matt Mullenweg rightly pointed out several years ago, simply hiding your WordPress version number is not enough by itself to stay protected from potential threats (you should always be keeping your WordPress installation up-to-date).

But perhaps you have a client who has specifically requested its removal or maybe you just like keeping things on the safe side, either way there are a lot of tutorials out there on how to remove it from various areas but none that I’ve found showing how to remove it from every area at the same time.

The WordPress version number appears in three areas:

1. Generator Meta Tag in the Header

<meta name="generator" content="WordPress 3.3.2" />

2. Generator Tag in RSS Feeds


3. Query Strings on Scripts & Styles

If a script or style does not specify a version number when enqueued, the current version of WordPress is used.


One Block of Code to Rule Them All

Just enter this into your functions.php file and your WordPress version will be safely hidden from the public.

However, there is one small caveat to be aware of when using this method: This function will check to see if the ver query string matches the WordPress version number, so if the version of the enqueued script happens to be the exact same as the WordPress version then its version string will be removed as well.

This will occur rarely (if ever), especially when the current WordPress version is a point release, such as 3.3.2.


Add yours →

  1. Good call on scrubbing the dependency versions. Here is an alternate filter which I think would be more robust:

    /* Hide WP version strings from scripts and styles
     * @return {string} $src
     * @filter script_loader_src
     * @filter style_loader_src
    function fjarrett_remove_wp_version_strings( $src ) {
    	global $wp_version;
    	parse_str(parse_url($src, PHP_URL_QUERY), $query);
    	if ( !empty($query['ver']) && $query['ver'] === $wp_version ) {
    		$src = remove_query_arg('ver', $src);
    	return $src;
    add_filter( 'script_loader_src', 'fjarrett_remove_wp_version_strings' );
    add_filter( 'style_loader_src', 'fjarrett_remove_wp_version_strings' );
  2. Hi

    Just a quick note to say thanks for the script.

    Been working on a WP website and some of the older alternatives simply did not work but this did straight away


  3. Here’s another alternative…

    function hide_wp_version($src) {
    global $wp_version;
    	return str_replace("?ver=$wp_version", "", $src);
    add_filter('script_loader_src', 'hide_wp_version');
    add_filter('style_loader_src', 'hide_wp_version');
  4. It correctly hides the version up to 3.6. But in the user’s profile page you can still see which WP version you’re using.

  5. Also delete (or rename) your readme.html in the root of our WP site, since that also reveals the version number:

  6. not work for me…with hostmarks theme

  7. Thanks for sharing. As alternative i found WP Hide & Security Enhancer plugin which also strip off lots of other WordPress things, it can be downloaded for free at

  8. Fatal error: Call to undefined function add_filter() in /home/bachatbag/public_html/wp-includes/functions.php on line 10

  9. I don’t see the code below this sentence “Just enter this into your functions.php file and your WordPress version will be safely hidden from the public”. So what does “this” mean?

Leave a Reply to Pratik Cancel reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: