All the sites created using WordPress show version number in HTML source code. Another place where version number of your site is shown is in RSS feeds. Smart Hackers will find the version using these ways and try to hack your sites using the loopholes or bugs in that version of WordPress.

Lots of post either recommend to remove the version number by commenting the following line in header.php file-

 

 

 or

 

add following function to functions.php file found in WP-Content/Themes/

remove_action(‘wp_head’, ‘wp_generator’);

 

But the above suggestions will not stop WordPress from sending version number to RSS Feed.

Steps to Remove the Version Number:

-Create custom-functions.php in WP-Content/Themes/

-Add following code in the file

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

 

WordPress will stop showing version number on all files after adding this function. This is the right way to remove the wordPress version number.

 

Note: To add custom PHP functions to the theme, create a new ‘custom-functions.php’ file in the theme folder. Try not to add functions to functions.php file.