Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

The Right Way to Remove WordPress Version Number

Leaving the WordPress version number in your website’s source code can make you vulnerable to online attacks. Hackers often target specific WordPress versions with known vulnerabilities.

For this reason, removing the WordPress version number from your website can greatly improve its security.

At WPBeginner, we’ve helped many websites boost their WordPress protection. And in this guide, we will show you the right way to remove the WordPress version number.

Hiding WordPress version number from your website

Why Remove WordPress Version Number?

Leaving the WordPress version number visible in your website’s source code can make it an easy target for hackers. This small detail can expose your site to vulnerabilities associated with that specific version, making it easier for attackers to exploit known issues.

By default, WordPress leaves its footprints on your site for tracking. That is how we know that WordPress is the top website builder in the world.

WordPress version shown in source code by default

However, sometimes, this footprint might be a security leak on your site if you are not running the most updated version of WordPress. It gives the hacker useful information by telling them which version you are running.

Hackers often target known security vulnerabilities in specific software versions. By hiding your WordPress version number, you make it slightly more difficult for attackers to determine which version of WordPress your site is running.

We recommend using the latest version of WordPress on all your websites so you don’t have to worry about this. However, if you are running an older version of WordPress, then you should definitely follow this tutorial.

It is quite difficult to remove all traces of which WordPress version your website is using. A sophisticated attack may still be able to find that information.

However, it will prevent automatic scanners and other less sophisticated attempts from guessing your WordPress version.

With that in mind, we’ll show you some ways to easily remove the version number from your WordPress website. Here’s a quick overview:

Ready? Let’s get started.

Method 1. Remove WordPress Version Information with Code (Recommended)

This method requires you to add code to your WordPress website. If you haven’t done this before, then see our guide on how to copy and paste code snippets in WordPress.

Now, many websites will recommend you edit your theme’s header.php file and get rid of the following line of code:

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

This method doesn’t work as a new theme update will automatically replace the old template with the new file.

Another commonly recommended but inefficient method is to put this code in your theme’s functions.php:

remove_action('wp_head', 'wp_generator');

This will only remove the information from the WordPress header. So, the version number will still be visible in your website’s RSS feeds.

The right way to remove WordPress version information is by disabling the function responsible for displaying it.

In order for you to completely remove your WordPress version number from both your header file and RSS feeds, you will need to add the following code to a code snippets plugin.

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

To make it even easier, you can use WPCode, which is the best code snippets plugin for WordPress.

WPCode has a built-in code library that has all of the most popular WordPress code snippets, including a snippet for removing the WordPress version number.

To get started, you’ll need to install and activate the free WPCode plugin. For step-by-step instructions, see our guide on how to install a WordPress plugin.

WPCode's homepage

Once the plugin is activated, you’ll need to head over to Code Snippets » Library from your WordPress dashboard.

Next, let’s search for the ‘Remove WordPress Version Number’ snippet and click on the ‘Use snippet’ button.

Select the Remove WordPress Version Number snippet in WPCode

WPCode will then automatically add the code, add a title for the code, and set the correct insertion method.

It will even add tags to help you organize it.

WPCode Remove WordPress Version code snippet

All you need to do is switch the toggle from ‘Inactive’ to ‘Active.’

Then, click the ‘Update’ button.

Switch the code snippet to Active and click Update in WPCode

Now, the WordPress version number will be hidden from your site’s frontend and RSS feeds.

Method 2. Remove WordPress Version Number using Sucuri

All top WordPress security plugins offer an option in the settings to hide your WordPress version number.

However, we recommend using Sucuri because it automatically hides WordPress version information and offers other more advanced security features.

Is Sucuri the right WordPress security plugin for you?

On top of that, Sucuri provides a firewall that filters and monitors HTTP traffic, blocking malicious threats before they reach your web server. If it detects malicious code, it allows you to clean up the website, removing the threats in the process.

Simply install and activate the Sucuri plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, the plugin will automatically hide WordPress version information. You can verify it by visiting Sucuri Security » Settings and switching to the Hardening tab.

Sucuri WordPress version hardening

Can You Completely Hide the WordPress Version?

WordPress may still add the version information in various other places throughout your website.

For instance, it is included as the query string in source code for CSS and JS files.

WordPress version shown with CSS and JS files

Removing all instances of WordPress version information can be time-consuming, complicated, and may not always work.

From a security perspective, removing the obvious generator tags can protect you from some very common attacks.

However, if someone is determined to break into your website, then hiding your WordPress version number does little to stop this.

You need to implement a proper WordPress security setup in place to make your website more secure. This adds layers of security around your website making it harder to hack into.

And you want to be choosing the best WordPress hosting provider for your website, since insecure web hosting is vulnerable to hacking attempts.

We hope this article helped you learn how to easily hide WordPress version numbers from your website. You may also want to see our guide on how to fix the password reset key error and our expert picks of the best WordPress activity log and tracking plugins.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

67 CommentsLeave a Reply

  1. kzain

    I didn’t realize how important it was to hide the WordPress version. Thanks for the clear and easy-to-follow steps. I’ll definitely implement these changes to enhance my website’s security.

  2. Dennis Muthomi

    I love how WPBeginner address the little things like this that most people are not aware of including me too.
    Thank you for this!

    • WPBeginner Support

      You’re welcome!

      Admin

  3. Jiří Vaněk

    Sometimes it fascinates me how many details can be done, e.g. in terms of security, that I would not have thought of. So I removed the Wordpress version from the website according to your instructions.

  4. Ashkan

    function wpbeginner_remove_version()
    what should we write instead of “wpbeginner” _remove_version?
    a specific file name or our website name or what?

    • WPBeginner Support

      You do not need to change wpbeginner in the function name.

      Admin

  5. shamol

    code not work

    • WPBeginner Support

      This is to remove the version number from the HTML header, if you want to remove the text that you are using WordPress then you would want to reach out to your specific theme’s support.

      Admin

  6. Peter

    It worked like a charm, also for woocommerce version number

  7. Sagar Patil

    it worked, thank you.

  8. Abhishek

    i have added this line in functions.php, but wapplyzer can still detect the version
    remove_action(‘wp_head’, ‘wp_generator’);

    • Ben Besselink

      Well Abhi, your code doesn’t remove the version in rss feeds.

  9. bayu

    hy.. a practice that is still usable ? I want to ask, how to hide the plugin that we use information from view page source and various wordpress detector … thanks alot.

  10. Ragoco

    Will this prevent Wordpress from auto-detect and notify me about new versions, so that i can update? Thanks

  11. Marine

    Hello,

    The functions.php is in my theme or in wp-includes, I have 2 files.
    Tx !!

    • WPBeginner Support

      The functions.php file in your theme is where you can add custom codes. You should never edit files in wp-includes folder.

      Admin

  12. Waqas

    thanks. Great way to do this.

  13. Chris Copland

    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?

  14. nicmare

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

    • Ted

      This doesn’t work for me.

  15. Lencho

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

  16. Nick McBurney

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

  17. cantor

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

  18. Dan

    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?

    Thanks

  19. Alys

    Hi

    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.

  20. Vinicius Silva

    thanks this really help me

  21. Chathu

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

  22. Igor

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

    • Dave

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

  23. Dave

    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.

  24. Jeremy Simkins

    I use this to remove the WordPress version.

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

  25. Travis Smith

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

    • Alex

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

      • Editorial Staff

        Add it in line 1. As long as it is not part of another function, then it would work.

        Admin

  26. Matthew Shuey

    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.

  27. mrahmadawais

    Why don’t wpbeginner use it ? :p

    • wpbeginner

       @mrahmadawais Because we keep the most updated version running.

  28. techispot

    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 http://www.techispot.com/feed

    Any one find solution please share

  29. brasofilo

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

    is this correct?

  30. Nacin

    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

      “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.

  31. N1NJA

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

    • Editorial Staff

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

      Admin

  32. Chuck Reynolds

    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 :)

  33. Brian

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

    • Editorial Staff

      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.

      Admin

      • Ray

        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.

  34. Nick

    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

      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.

      Admin

      • Nick

        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!!!

  35. Nick

    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.

    • Editorial Staff

      Did you copy and paste the code exactly from this site? It has to be inside php tags.

      Admin

  36. Djolhan

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

  37. Duncan

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

  38. Roseli A. Bakar

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

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.