Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

The Right Way to Remove WordPress Version Number

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
The Right Way to Remove WordPress Version Number

By default WordPress leaves it’s footprints on your site for the sake of tracking. That is how we know that WordPress is the World’s largest Blogging platform. But sometimes this footprint might be a security leak on your site if you are not running the most updated version of WordPress. Because you are providing the hacker with the useful information by telling them which version you are running.

If you are running the most up to date version of WordPress, which we recommend you do, then you do not have to worry about this tutorial at all. But if for some reason you are not, then it is in your best interest to follow this tutorial.

There are many ways to get rid of the WordPress version number from your header. But there is only one correct way to do this.

Some sites will recommend that you open your header.php file and get rid of this code:

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />

Or others will recommend that you open your functions.php and add the following function:

remove_action('wp_head', 'wp_generator');

But both of these ways are offering you an incomplete solution. These ways will simply remove the WordPress version number from your head area. So if someone views your website source, they will not be able to see the version.

But a smart hacker who knows about WordPress will simply go to your RSS Feeds, and they will find your version number there because neither of the above codes will remove that number.

In order for you to completely remove your WordPress version number from both your head file and RSS feeds, you will need to add the following function to your functions.php file:

function wpbeginner_remove_version() {
return '';
add_filter('the_generator', 'wpbeginner_remove_version');

By adding this version, you will remove the WordPress version number from all different areas on your site. Above is the right way to remove WordPress Version number.

Note: We still recommend that you update to the latest version of WordPress because that is the only guaranteed way to keep your blog protected.

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Chris Copland says:

    For those like me who have read this to the bottom looking for a definitive answer only to be left wanting despite all the possibilities no one has Identified a solution that works for everyone.

    I suggest you load WordPress in Wamp or similar and check every possibility.

    How about the editorial staff have a look remove…remove the wheat from the chaff and re-post
    The Right Way To Remove WordPress Version Number?

  2. nicmare says:

    why so complicated? make it easy:
    // remove wp version
    add_filter(‘the_generator’, ‘__return_false’);

  3. Lencho says:

    If I’m using a a premium theme and the developer who keeps updating it, do I need to worry about this issue?

  4. Nick McBurney says:

    What do you think to using the following in functions.php?
    remove_action(‘wp_head’, ‘wp_generator’);

  5. cantor says:

    this does nothing, I can still get the version number using fingerprinting….

  6. Dan says:

    Maybe I’m missing something here, but adding the filter does remove the version number but fails to remove it from the end of some of the styles sheets and a few .js files as well from plugins. i.e.

    ….css?ver=3.8.1′ type=’text/css’ media=’all’ />

    Anyway to remove those as well?


  7. Alys says:


    none of these methods work with WP 3.8/ RC2

    I put the code:

    function wpbeginner_remove_version() {
    return ”;
    add_filter(‘the_generator’, ‘wpbeginner_remove_version’);

    in the bottom of my functions.php file. No effect.

    Here is a sample of the scripts loading when I look at the source code, and you can see the wp ver is still tacked onto the end….

    I tried some of the other code suggestions in this thread, and none of them worked either.

    Perhaps I am doing something wrong?

    Many thank in advance for your suggestions.

    As you can see it is still showing at the end of each.

  8. Vinicius Silva says:

    thanks this really help me

  9. Chathu says:

    But still Sucuri shows my WordPress version using the /wp-admin/js/common.js file.

  10. Igor says:

    One should also delete readme.html in the root of the website because it contains WP version number.

  11. Madona says:

    There is a plugin for that. Very simple >

    • Dave says:

      That plugin doesn’t remove the version number. It changes the prefix (wp_) for the database tables.

  12. Dave says:

    It should also be mentioned that if you want to hide the number, you should also get rid of the readme.html file that accompanies WordPress, as it displays the version in big giant numbers right at the top of the page. Last I read, it also hides in a JavaScript file somewhere as well, but I’m not sure which one.

  13. Jeremy Simkins says:

    I use this to remove the WordPress version.

    ‘remove_action(‘wp_head’, ‘wp_generator’); // Remove WordPress version from site’

  14. Travis Smith says:

    A cleaner way is just this:
    add_filter( 'the_generator', '__return_null' );

    • Alex says:

      WHERE DO I ADD THIS add_filter( ‘the_generator’, ‘__return_null’ ); in functions.php WHERE
      WHICH LINE?!

  15. Matthew Shuey says:

    This is arguably on of the most useful code snippets ever. Plugins break so this is a perfect way to remove the generator meta tag from WordPress.

  16. mrahmadawais says:

    Why don’t wpbeginner use it ? :p

  17. techispot says:

    Sorry to say it is not working with feed, I means it not remove version number from feed, I personally add the function you specified , it remove from my home page source but not from rss page source, you can view my rss page source it is still there

    Any one find solution please share

  18. brasofilo says:

    i wanted to keep the generator without the version number, so i’m returning instead of an empty string…

    is this correct?

  19. Nacin says:

    Removing the generator code has nothing to do with security, frankly. If someone is targeting your site in particular, there are other effective ways to determine a version number. If it’s just a malicious script, it’s going to try every exploit that has ever worked regardless of your version. Indeed, we have never seen an exploit script attempting to do version detection.

    Also, the statement “While plugins are great, they somewhat slow your site down,” is a bit misleading in this context, I feel. Yes, a lot of plugins that do heavy-lifting will increase drag on a server. But a good amount of core uses the Plugin API to hook into itself, using the same methods as a plugin. And adding this code to functions.php is doing the same thing.

    • Roger Ruz says:

      “Also, the statement “While plugins are great, they somewhat slow your site down,” is a bit misleading in this context, I feel. ”

      Nice argument! I’m researching on how to remove plugin scripts that are not necessary/not in use to a page but being requested every time in the server.

  20. N1NJA says:

    Thanks dude worked like a charm thanks again keep up the good work :)

  21. Smashing Share says:

    Thats really great tip. Working perfect! Thanks

  22. topdown says:

    It still leaves the version in the RSS source

    • Editorial Staff says:

      Do you have a screenshot? Because we activated this function on a few sites and it didn’t show.

  23. Chuck Reynolds says:

    The only thing that bothers me about this is that it leaves the line open in the header… not normally an issue but my ocd hates that part :)

  24. Brian says:

    I was using the remove_action method. Can’t thank you enough :)

  25. Ray says:

    Realized that the “Secure WordPress” plugin already does that for you and more. Assuming most people would be interested in securing their WordPress (not just hiding the version number), it would be better to make use of that plugin to do all these for you.

    Incidentally, I got to know of the Secure WordPress plugin via wpbeginner.

    Nice work guys! Keep on writing!

    • Editorial Staff says:

      While plugins are great, they somewhat slow your site down. Why use a plugin if it can be done with a simple function in your functions.php file. But yes Secure WordPress plugin does that as well on all versions older than 2.4.

      • Ray says:

        Would have to agree with you on that: just modding the functions.php would be more efficient than adding a plugin just to remove the version number.

  26. Nick says:

    Ok, I’ve found the error.

    You must add the created function in the plugin.php file and not in the function.php file.

    • Editorial Staff says:

      The whole idea for this code is so you don’t have to edit any core files. If you edit plugin.php whenever you next update WordPress it will come back.

      • Nick says:

        Ok the error was mine, I was modifying the wrong function.php file.
        The correct one is function.php inside the theme directory and not the one in the core.

        Thank you!!!

  27. Nick says:

    It’s strange, it gives me the error:
    Call to undefined function: add_filter()

    But I’ve checked the plugin.php file and I have obviously the add_filter() funciont defined.

    Any suggestion? Ths.

  28. Djolhan says:

    It’s a nice tips, thanks a lot ! Probably the best way to remove it !

  29. Duncan says:

    Great tip! nice to see a complete fix tutorial out there.

  30. Roseli A. Bakar says:

    I’m sure a lot of bloggers doesn’t know how to remove the wordpress version correctly, this post is a great help.

  31. Cayo Medeiros aka. yogodoshi says:

    Will it remove only the version number or the “WordPress” name too?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.