Remove WP Generator Meta Tag

It can be considered a security risk to make your wordpress version visible and public you should hide it.

Put in functions.php file in your theme:

remove_action('wp_head', 'wp_generator');


  1. User Avatar
    Permalink to comment#

    this so doesn’t work.

  2. User Avatar
    Permalink to comment#

    It works fine for me. Thanks Chris.
    Btw, for those who are obsessed with high level of security, this plugin could be of some help.

    Secure WordPress

  3. User Avatar

    Thank you Chris it work fine for me

  4. User Avatar
    Permalink to comment#

    Wow, this works like a charm. It has been removed on all pages.

    I did not think that removing page generator is just so easy like this.

    Thanks for sharing.

  5. User Avatar
    Pusat Mutiara Lombok
    Permalink to comment#

    Thank you Chris it work fine for me, nice tips :)

  6. User Avatar
    Permalink to comment#

    Very nice works perfectly!
    Thanks for sharing.

  7. User Avatar
    James Kirk
    Permalink to comment#

    And that snippet of code still works like a champ, today.

    One thing I remember from a few years ago when trying to remove the WP version generator was the specific theme I was using (apologies for not remembering which one it was) actually had some WP Version generator code in the <head> section of the theme’s header.php files. So, not only was I getting two WP version lines in the output code, this type of version “de-generator” only removed one of them. About pulled my hair out trying to solve the challenge! Finally did, however.

  8. User Avatar
    Connor Gurney
    Permalink to comment#

    Hi Chris, I’m the one that tweeted you :)

    Thanks for the code, I was trying to edit the wp_head(); function !! :D

    Thanks again


  9. User Avatar
    Permalink to comment#

    Thank you so much for sharing my friend this works perfectly

  10. User Avatar
    reduc suisse
    Permalink to comment#

    Thanks, it works for me after many and many issues ;)

  11. User Avatar
    Permalink to comment#

    Ok. Why is this so important? All they need to do is type in wp-admin after the url to know its a WP site or administrator and viola it’s Joomla!

  12. User Avatar
    Permalink to comment#

    Excellent, it’s working for me !

  13. User Avatar
    Permalink to comment#

    Doesnt work for WP 3.5 though..

    • User Avatar
      Permalink to comment#

      Yes, it works with WP 3.5.1, at least with the Twentyeleven theme.

      Thanks Chris!!

    • User Avatar
      Imperative Ideas
      Permalink to comment#

      As I posted below, it doesn’t work because you are using a child theme. Add a priority of 99 and it’ll work.

  14. User Avatar
    john chimera
    Permalink to comment#

    Is there any alternative?

  15. User Avatar
    Permalink to comment#

    Yes, it is working, Thank you Chris.

  16. User Avatar
    Permalink to comment#

    Yup mine still shows after using this line.

  17. User Avatar
    Guilherme Henrique
    Permalink to comment#

    This is good, but thats don’t remove the generator and version form the RSS feed, and this can be like this:

    add________action('the________generator', '__________return_false');


    add________filter(‘the________generator’, ‘__________return_false’);

  18. User Avatar
    Imperative Ideas
    Permalink to comment#

    The correct method is:

    remove_action( 'wp_head', 'wp_generator', 99 ); // WP version
    add_filter('the_generator', 'wpbeginner_remove_version', 99); // Also remove from RSS

    First part: If you don’t add a PRIORITY then you try to remove the generator before WP has added it, especially in a child theme.

    Second part: You haven’t removed the generator from the RSS feed so your efforts are totally in vain. Code is included.

    Third part: This also goes for deleting readme.txt from the base install. If you don’t remove it in all three places, you may as well not remove it at all.

  19. User Avatar
    Todd Dawson
    Permalink to comment#

    If I use this, or the Meta Generator and Version Info Remover plugin, will WordPress detect and notify me when an upgrade is issued? Otherwise, will I have to constantly check WP to see if there’s a new version?

  20. User Avatar
    Roger Ruz
    Permalink to comment#

    Works fine on my site! Thank You!

  21. User Avatar
    Permalink to comment#

    It worked smoothly for me. Thanks Chris.

  22. User Avatar
    Tony Carnell
    Permalink to comment#

    Just used this code for a WP 3.8 installation and it worked like a dream.
    Thanks for sharing this Chris.

  23. User Avatar
    Permalink to comment#

    This does not hide version information from RSS. Use this instead:

    // hide the meta tag generator from head and rss
    function disable_version() {
       return '';
    remove_action('wp_head', 'wp_generator');

Leave a Comment

Posting Code!

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.