Tech Magazine

How to Hide Or Remove WordPress Version Number

Posted on the 06 July 2018 by Jyotiray

By default, WordPress automatically adds a meta tag which displays the WordPress version number. This meta tag is used for tracking purpose and it also shows which WordPress version you are using. Using this method, any advance user can figure out how many sites are powered by WordPress and which WordPress version you are running. 

If you are not updating your WordPress site to the latest version, then hackers try to find the known vulnerabilities in your site to hack your site. In a study, there are over 33% WordPress sites are outdated and vulnerable to hacks. Now, if your site is one of them, then your site can get hacked easily. That’s why we always recommend keeping your WordPress site updated.

If you regularly update your WordPress site, then you may not need to hide or remove your WordPress version. Because with every WordPress update, developers fix the known vulnerabilities. In case, you don’t update your WordPress version, then you need to follow the steps below. In this article, I will show how to hide or remove WordPress version number from the header, RSS, CSS and style scripts.

Remove WordPress Version Number

How to Find WordPress Version of a Site?

There are many places where WordPress adds the version number in your site, for example: in your WordPress dashboard, in the header section, in the RSS feed, in CSS and style scripts.

1. Checking WordPress Version in Dashboard

Login to your WordPress dashboard, then under “At a Glance” option, you can see your WordPress version number. Here’s the screenshot how it looks like.

WordPress Version Number in Dashboard

2. Checking the WordPress version in Header Section

To find your WordPress version in the header section, just right click anywhere on your site and view the source code on a browser. There you can find the WordPress version like below (Here 4.9.7 indicated the current WordPress version).

<meta name="generator" content="WordPress 4.9.7" />

3. Checking the WordPress version in Styles and JavaScript

Many of the WordPress scripts and style sheets contain the WordPress version number. You can find it by viewing page source on your site. 

?ver=4.9.7

4. Checking the WordPress version in RSS feed

The RSS feed of your site also contains your WordPress version number. To check this, type “yoursite.com/feed” on your web browser and under the title tag, you can see the version number.

<generator>https://wordpress.org/?v=4.9.7</generator>

How to Remove WordPress Version Number

There are several ways you can remove the WordPress version number. But, I will show you the easiest way to do this. For this method, we wouldn’t use any plugin because if the plugin is not updated regularly with WordPress, then it can be an easy way for hackers to compromise with your site.

So, I will add a few codes in the functions.php file of your theme.

1. Removing WordPress version number from the header and RSS

To remove the version number from your WordPress site, simply add the following code to your functions.php file. You can find the functions.php file by going Appearance> Editor.

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

Scroll to the end of functions.php, then add the code and click on update file.

This will remove the WordPress version number from the header and RSS. You can check if the version number has been removed or not by viewing the page source on your site.

2. Removing WordPress version number from Scripts and CSS

The above method will only hide the WordPress version number from the header and RSS. To remove the version number from CSS and scripts, simply add the following code to your functions.php file. 

// Pick out the version number from scripts and styles
function remove_version_from_style_js( $src ) {
if ( strpos( $src, 'ver=' . get_bloginfo( 'version' ) ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_version_from_style_js');
add_filter( 'script_loader_src', 'remove_version_from_style_js');

After adding the codes to your functions.php file, don’t forget to update  the file.

By doing this, you can remove the WordPress version number from CSS and Scripts.

That’s it. By applying the two methods, you can completely hide or remove the WordPress version number from the header, RSS, CSS, and scripts. We still highly recommend you to keep your WordPress site updated.

I hope this tutorial helped you to remove WordPress version number from all places. In case, you are getting an error, leave a comment below. If you like this tutorial, do share it with your friends.

Related Posts,


Back to Featured Articles on Logo Paperblog

Magazine