By default, WordPress includes its version number in the page source code, which can potentially expose your website to security vulnerabilities. It adds a generator meta tag in the <head>
of your site, like so:
<meta name="generator" content="WordPress 6.1.1" />
To remove this generator meta tag in order to clean up your site’s code and provide an extra bit of security through obscurity, you can use the following snippet:
add_filter('the_generator', '__return_empty_string');