Sometimes, letting displayed your WordPress version can be a serious security risk and this can also be helpful to hackers. The easiest way to get WordPress version information of any site is check its Meta code. By default WordPress prints your current WordPress version on your theme’s header that can be easily viewed by checking the source code of your site. If you are not running the latest WordPress version, then it could be more serious.
There are a number of tricks and methods available to get rid of WordPress version information from your header. You can install a plugins for removing WordPress version but i don’t think this will be a smart decision to run a plugin for such small cause, when you can do this just by adding a small code snippet to your theme function.
Easy Method to Remove WordPress Version Info
For easy removal you can just search for this code on your theme header.php file and simply remove this. This is the conventional way of removing WordPress version from your theme. Just remove following code from your theme header.
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
This will remove WordPress version information from your theme header but even after removing above code from your theme header, here is still an easy way to get WordPress version information by checking your RSS feed. So I don’t trust on above method.
Trusted Way to Remove WordPress Version Info
The more trusted way I use is adding a simple code to your functions.php file. Actually we can add a simple ‘the_generator‘ filter to remove WordPress version information from every where your site header, RSS feed etc… Just add a simple function to your functions.php file to invoke the user-defined function ‘bt_remove_version‘ to return a blank instead of the WordPress version.
<?php
function bt_remove_version() // Remove WordPress Version Information
{
return '';
}
add_filter('the_generator','bt_remove_version');
?>
The Above function ‘bt_remove_version‘ is a user-defined WordPress function that will remove WordPress version information from everywhere, your theme, header, feed etc…
Note: don’t forget to remove opening and closing php tags while adding the above function to your theme function file, otherwise you may get error.
Recommended: It’s always recommended to keep updated your WordPress version to reduce security risks and keep your WordPress site more secure.