WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» The Right Way to Remove WordPress Version Number

The Right Way to Remove WordPress Version Number

Last updated on June 21st, 2012 by Editorial Staff
28 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
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.

28 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • How to Properly Move Your Blog from WordPress.com to WordPress.org

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

63 Comments

Leave a Reply
  1. Ashkan says:
    Oct 24, 2020 at 8:07 am

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

    Reply
    • WPBeginner Support says:
      Oct 26, 2020 at 11:24 am

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

      Reply
  2. shamol says:
    Jan 20, 2019 at 6:43 am

    code not work

    Reply
    • WPBeginner Support says:
      Jan 22, 2019 at 3:37 pm

      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.

      Reply
  3. Peter says:
    Jun 27, 2018 at 5:10 am

    It worked like a charm, also for woocommerce version number

    Reply
  4. Sagar Patil says:
    Feb 9, 2017 at 3:01 pm

    it worked, thank you.

    Reply
  5. Abhishek says:
    Oct 24, 2016 at 10:41 am

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

    Reply
    • Ben Besselink says:
      Apr 14, 2017 at 3:34 pm

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

      Reply
  6. bayu says:
    Oct 13, 2016 at 10:05 pm

    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.

    Reply
  7. Ragoco says:
    Oct 8, 2016 at 2:23 pm

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

    Reply
    • WPBeginner Support says:
      Oct 10, 2016 at 1:18 pm

      No it won’t. We do not recommend you to disable updates. Keeping your WordPress site up to date protects your site from security vulnerabilities. Please see our guide on why you should always use the latest version of WordPress.

      Reply
  8. Marine says:
    Aug 19, 2016 at 3:23 pm

    Hello,

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

    Reply
    • WPBeginner Support says:
      Aug 22, 2016 at 12:27 am

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

      Reply
      • Marine says:
        Aug 23, 2016 at 3:59 am

        Tx !

        Reply
  9. Waqas says:
    Mar 10, 2016 at 3:34 am

    thanks. Great way to do this.

    Reply
  10. Chris Copland says:
    Jul 19, 2015 at 2:24 pm

    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?

    Reply
  11. nicmare says:
    May 29, 2015 at 4:11 am

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

    Reply
    • Ted says:
      Jul 15, 2015 at 2:55 pm

      This doesn’t work for me.

      Reply
  12. Lencho says:
    Jan 8, 2015 at 7:03 pm

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

    Reply
  13. Nick McBurney says:
    Jul 23, 2014 at 7:57 am

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

    Reply
  14. cantor says:
    Mar 3, 2014 at 6:45 am

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

    Reply
  15. Dan says:
    Feb 26, 2014 at 8:44 pm

    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

    Reply
  16. Alys says:
    Dec 11, 2013 at 9:39 pm

    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.

    Reply
    • WPBeginner Support says:
      Dec 12, 2013 at 7:47 pm

      Try switching to a default theme and then try to remove generator meta tag.

      Reply
  17. Vinicius Silva says:
    Nov 1, 2013 at 1:11 pm

    thanks this really help me

    Reply
  18. Chathu says:
    Sep 21, 2013 at 10:56 am

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

    Reply
    • WPBeginner Support says:
      Sep 21, 2013 at 11:00 pm

      You can password protect WordPress admin directory.

      Reply
      • Chathu says:
        Sep 29, 2013 at 2:46 am

        Yes, got it. Thank you so much.

        Reply
      • Chathu says:
        Sep 29, 2013 at 3:10 am

        Nope. It’s not working. Still sitecheck.sucuri.net show me that admin file,

        Web application version:
        WordPress version: WordPress
        Wordpress Version 3.6.1 based on: http://www.mydomain.com//wp-admin/js/common.js

        Reply
  19. Igor says:
    Jul 12, 2013 at 1:31 am

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

    Reply
  20. Madona says:
    Jun 12, 2013 at 6:23 am

    There is a plugin for that. Very simple > http://wordpress.org/plugins/db-prefix-change/installation/

    Reply
    • Dave says:
      Jun 13, 2013 at 10:25 am

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

      Reply
  21. Dave says:
    Jun 2, 2013 at 12:03 am

    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.

    Reply
  22. Jeremy Simkins says:
    Feb 6, 2013 at 9:53 pm

    I use this to remove the WordPress version.

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

    Reply
  23. Travis Smith says:
    Feb 1, 2013 at 9:56 pm

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

    Reply
    • Alex says:
      Jun 21, 2013 at 8:54 am

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

      Reply
      • Editorial Staff says:
        Jun 21, 2013 at 2:26 pm

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

        Reply
  24. Matthew Shuey says:
    Oct 17, 2012 at 6:44 pm

    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.

    Reply
  25. mrahmadawais says:
    Apr 14, 2012 at 3:44 am

    Why don’t wpbeginner use it ? :p

    Reply
    • wpbeginner says:
      Apr 30, 2012 at 8:54 am

       @mrahmadawais Because we keep the most updated version running.

      Reply
  26. techispot says:
    Nov 30, 2011 at 11:17 am

    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

    Reply
  27. brasofilo says:
    Sep 10, 2011 at 9:00 pm

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

    is this correct?

    Reply
  28. Nacin says:
    Jun 8, 2010 at 2:12 pm

    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.

    Reply
    • Roger Ruz says:
      Sep 24, 2013 at 8:22 am

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

      Reply
  29. N1NJA says:
    Jun 3, 2010 at 1:43 am

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

    Reply
  30. Smashing Share says:
    May 1, 2010 at 1:03 pm

    Thats really great tip. Working perfect! Thanks

    Reply
  31. topdown says:
    Feb 8, 2010 at 1:58 am

    It still leaves the version in the RSS source
    http://wordpress.org/?v=2.9.1

    Reply
    • Editorial Staff says:
      Feb 8, 2010 at 6:56 am

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

      Reply
  32. Chuck Reynolds says:
    Feb 3, 2010 at 6:09 pm

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

    Reply
  33. Brian says:
    Jan 24, 2010 at 11:59 am

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

    Reply
  34. Ray says:
    Jan 24, 2010 at 10:43 am

    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. https://www.wpbeginner.com/wp-tutorials/11-vital-tips-and-hacks-to-protect-your-wordpress-admin-area/

    Nice work guys! Keep on writing!

    Reply
    • Editorial Staff says:
      Jan 24, 2010 at 11:52 am

      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.

      Reply
      • Ray says:
        Feb 8, 2010 at 8:34 am

        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.

        Reply
  35. Nick says:
    Jan 24, 2010 at 10:27 am

    Ok, I’ve found the error.

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

    Reply
    • Editorial Staff says:
      Jan 24, 2010 at 11:49 am

      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.

      Reply
      • Nick says:
        Jan 24, 2010 at 12:20 pm

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

        Reply
  36. Nick says:
    Jan 24, 2010 at 4:42 am

    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.

    Reply
    • Editorial Staff says:
      Jan 24, 2010 at 10:28 am

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

      Reply
  37. Djolhan says:
    Jan 23, 2010 at 12:51 pm

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

    Reply
  38. Duncan says:
    Jan 23, 2010 at 11:51 am

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

    Reply
  39. Roseli A. Bakar says:
    Jan 23, 2010 at 11:33 am

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

    Reply
  40. Cayo Medeiros aka. yogodoshi says:
    Jan 23, 2010 at 10:25 am

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

    Reply
    • Editorial Staff says:
      Jan 23, 2010 at 10:38 am

      It will remove both. The entire generator code.

      Reply

Leave a Reply Cancel 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.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
OptinMonster
OptinMonster
Convert website visitors into email subscribers. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2021 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2021)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2021)
    • SiteGround Reviews from 4464 Users & Our Experts (2021)
    • Bluehost Review from Real Users + Performance Stats (2021)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2021 – Step by Step Guide
Deals & Coupons (view all)
SendinBlue Coupon Code
Sendinblue Coupon
Get Sendinblue, a powerful marketing automation toolkit for small businesses, for FREE.
Beaver Builder Coupon Code
Beaver Builder Coupon
Get the best possible price on this easy drag-and-drop page builder plugin. From just $99 in 2020.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).

Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
  • Growth Fund
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon
  • AIOSEO

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress Security by Sucuri.