While you use WordPress CMS as to create your site, it is going to create the generator tag in the sites head, which is used to show the current version of WordPress installed in your site. It may also be risky to display the WordPress version used in your site since it leaks the version of the WordPress used in your site. And if the hacker founds it that you are using old version of WordPress in your site, then, they may attempt to hack your site. So, removing the WordPress generator tag, in one way can create your site more secure.
From the above description or introduction, now you may be is great pain about how to remove it from your site, right? Well, so why to keep waiting for you to remove WordPress generator tag. Hence, lets get ahead and can paste this PHP code in the functions.php file of your child theme in order to remove WordPress generator tag from your site:
remove_action('wp_head', 'wp_generator'); // remove the WordPress generator tag from head section
We have asked you to add the PHP code in the child theme, since, if you are using the theme hosted in WordPress.org, then, the theme is not allowed to do so. But, you do not know about how to create the child theme. You do not need to worry about it, we have also written the post about creating the WordPress child theme too, which you can find below:
Now, if you have added the above code in the same file mentioned above, the WordPress generator tag will be removed from the head section of your site and the user will now not know which version of WordPress is being used in your site.
The image above is default generated by WordPress, which has the generator tag in it. Here, you can see that it provides the user about which version of WordPress is used to built that site.
And, the above image is after the code has been add in the mentioned file above. Here, you can see that the WordPress generator tag has been removed from the head section, and now, your site is more secure than before from one aspect.
If you have followed the above tutorial properly and able to do the same in your site, then, we can assume that you are now more familiar about how to remove WordPress generator tag from your site. But, you are still confused and is not able to do the same, then, leave a comment below and we will follow it up.