Skip to content

How To Remove WordPress Version Number

In this tutorial, I’ll show you how to remove WordPress version number. WordPress leaves its version number on the header of your website for tracking. While the version number wouldn’t do anything for you, it can help hackers by telling them version of WordPress you’re currently using.

Some people use old versions of WordPress, so this version number might give hacker an opportunity to attack your website if you’re not running the most updated version of WordPress. For whatever reason, if you’re running an older version, please make sure to follow this tutorial to make it harder for hackers to hack your website. I promise this is the best tutorial available on the World Wide Web with the solution of this issue.

First we will stop WordPress from rendering version number on our website’s header by adding following snippet to your current theme’s functions.php file:

remove_action('wp_head', 'wp_generator');

Removing version number from the header of your website is just not enough. Hackers are smart enough to get version number from the feed of your website, so we will add following to functions.php file:

function wp_remove_version() {
return '';
}
add_filter('the_generator', 'wp_remove_version');

So, we removed from the feed too. Anything else left? Yea, WordPress also renders the version number in the scripts & style sheets of your website. We can get rid of it too with the following snippet:

function port_remove_cssjs_ver( $src ) {
    if( strpos( $src, '?ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
add_filter( 'style_loader_src', 'port_remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'port_remove_cssjs_ver', 10, 2 );

Through we have removed the version number from the website, yet it’s really important to always use the latest version of the WordPress.

Leave a Reply

Your email address will not be published. Required fields are marked *