Regardless the design or the original source code of your theme, WordPress always leaves it’s version number on the final source code of your site. Now, this version number could be good as well as bad in many ways. It’s good because many web crawler can get some extra information about your site and also WordPress itself can track your site based on this information, bad thing is like hackers can use this little piece of info about your site and can pose potential security threat.
Especially if you are running older versions of WordPress then you really should not disclose your WP version number. Even though I personally encourage everyone to keep their WordPress up to date but many people might find it little overwhelming. Back in 2011, I wrote a post on How to upgrade WordPress Manually, check it out if you are too scared to update.
Let’s get back on track. First of all, let’s check what exactly I am talking about. Go to your WP based site and take a look at the source code of it. Right before the </head> tag you will find something like:
This is the automatically generated source code of our site. But the version number on your site might vary based on the version you are using. But if you want to remove this code, follow the steps mentioned below.
Step 1: Simply log in to your site and click on Appearance > Editor.
Step 2: Go to your themes functions.php file.
Step 3: Copy and Paste the following code on your functions.php file and update it.
function wpbeginner_remove_version() { return ''; }
add_filter('the_generator', 'wpbeginner_remove_version');
?>
That’s it, you are good to go. Now before your stop reading this post, just go back to the front end of your site and refresh your page. Take a look at the source code again. I believe you won’t find the automatically generated WordPress version number anymore.
I personally tested this code on WP 3.0, 3.3.1 and it worked fine. But I am not quite sure whether it’s gonna work on some really older versions or not. So, check it out and let us know. Hope that helps.
























It's Your Turn, Say Something...