Why you should remove wordpress version number

Do you know the reason behind most WordPress site hacking? Or are you suffering from CSS and JavaScript changes not affecting to your WordPress website?

So, why you should remove WordPress version number from WordPress website.

Website hacked because of the lack of security updates.

The main reason behind some hacked WordPress website is the version number added to your CSS or JavaScript files. By default, WordPress adds its current version at the end of each and every CSS and js files called from your website. If you are using an old WordPress version, you must have to update it immediately because using an old WordPress version will increase the chance of being hacked.

Many WordPress users asked me questions that updating WordPress will mess their site? And I say, NO. I recommend them to use up to date WordPress version because WordPress keep increasing and releasing security updates. So, If you are worried about possible website messed up, Go for it, it will never ever mess your website.

See Also: How to fix β€œAre you sure you want to do this?” error while uploading theme zip?

Changes you do to CSS and JS files are not affected.

Suppose you are doing changes in your CSS or JavaScript files and it’s not affecting even if you cleared browser cache and web host cache. Removing the WordPress version number from stylesheet and JavaScript files will fix your problem. πŸ™‚
See below how you can remove WordPress version number from your website.
Add the following code at the end of your active theme’s functions.php file.

function wptechie_remove_version() {
return '';
add_filter('the_generator', 'wptechie_remove_version');

If for some reason, this code won’t work for you, try putting following code to the same functions.php file. It will definitely work for you πŸ™‚

function wptechie_remove_wp_ver_par( $src ) {
if ( strpos( $src, 'ver=' . get_bloginfo( 'version' ) ) )
$src = remove_query_arg( 'ver', $src );
return $src;
add_filter( 'style_loader_src', 'wptechie_remove_wp_ver_par', 9999 );
add_filter( 'script_loader_src', 'wptechie_remove_wp_ver_par', 9999 );

Love this post? Sign Up below to get more tutorials and tips like this in your Inbox