Hide the WordPress Version Number for Better Security

Problem/Use Case:
WordPress outputs its version number in the site’s source code, which can expose your site to potential hackers.

Snippet (functions.php):

// Remove WordPress version from head
remove_action('wp_head', 'wp_generator');

Explanation:
This removes the generator meta tag from your site’s <head> section, hiding the WordPress version number.

Where to Place It:
Add this snippet in your theme’s functions.php file or a custom plugin.

Bonus Tip:
You can also hide the version from RSS feeds by adding:

add_filter('the_generator', '__return_empty_string');
Ndifon Luke
Ndifon Luke

Ndifon Luke is the founder & owner of Uncle Luke Digitals—a web design, digital marketing freelancer based in Bamenda, Cameroon. He has over 6 years of expertise in digital marketing and is very passionate about working with clients in achieving their business objectives.