

Improve your WordPress security by learning how to effectively hide/remove your WordPress version number. This snippet provides essential steps for security reasons, making your website more robust against potential threats.
<?php
add_filter('the_generator','_return_empty_string');
function remove_version_from_assets($src) {
$wp_version = get_bloginfo('version');
if(strpos($src,'ver='.$wp_version) !== false) {
$src = remove_query_arg('ver',$src);
}
return $src;
}
add_filter('style_loader_src','remove_version_from_assets',9999);
add_filter('script_loader_src',' remove_version_from_assets',9999);
Follow these simple steps to remove your WordPress version number using WPCodeBox:
That’s it! Your WordPress version number is now hidden from public view.
The WordPress version number visible in your website’s source code exposes which specific release you’re running. This allows hackers to cross-reference this information with publicly documented vulnerabilities in security databases like CVE (Common Vulnerabilities and Exposures). When attackers discover your version number, they can immediately identify known exploits for that release and launch targeted attacks, potentially stealing sensitive information, locking you out for ransom, or bringing down your site.
WordPress version numbers appear in three locations on your website:
Generator Meta Tag: The most common location is in the HTML <head> section of your site, where WordPress automatically inserts a meta tag by default:
<meta name="generator" content="WordPress 6.8.3" />
You can find this by right-clicking on your site, selecting “View Page Source,” and searching for “generator.” This tag is added automatically by WordPress themes unless specifically removed.
Scripts and Styles Query Strings: WordPress appends version numbers as query string parameters to CSS and JavaScript files. These appear as:
subscriptions.css?ver=6.8
The version number can represent different things depending on the context. For WordPress core files, it typically reflects the WordPress version itself.
RSS Feed: WordPress includes version information in your site’s RSS feed using a generator tag:
<generator>https://wordpress.org/?v=6.8.3</generator>
While disabling the version number alone can’t be considered a comprehensive security solution, there are several situations where it remains beneficial:





