By default WordPress adds the version number to the header of your WordPress website. This information might be a lot helpful for a hacker who are trying to exploit any known vulnerability older version of WordPress.Do not worry! We have a solution for you. In addition to using the given solution, we always recommend using latest version of WordPress.

You can simply add this line of code in functions.php file which is located in your current active theme in themes folder to remove WordPress version number. It simply removes the wp_generator action which prints the version number.

remove_action('wp_head', 'wp_generator');

How to remove version number from Woocommerce website?

If you are using woocommmerce as your ecommerce site, you may notice that it also adds version number as meta tag. It can also be easily removed from using the following code in functions.php file.
remove_action( 'wp_head', 'wc_generator_tag' );

Feel free to comment and ask any question or doubt you may have about the above method, we will try to reply you back ASAP.