Steps to Remove WordPress Version Number Easily

WordPress version number consists of two or three numbers separated by periods and is used for version control. With every new development and upgrade of WordPress, the version number increases. The latest stable release of WordPress is Version 4.5.2. Here, the first number 4 is changed or increased when WordPress software is upgraded with major changes. The second number 5 is increased when WordPress is upgraded with minor features and fixes. The third number 2 is called the revision number and is added when minor bugs are eliminated. You can view the list of all the versions of WordPress. This article provides steps to remove WordPress version number easily from your WordPress site.

You should hide WordPress version number for security reasons. When someone tries to break into your website, the first thing they look for is the version of the software. If your WordPress is outdated then you are at risk. The newer version of WordPress publishes security fixes that they imply whereas older versions have a lot of security loopholes. So, if your hacker gets your WordPress version number, it is easy for them to exploit any known hacking methods on a particular WordPress version. If you have a lot of plugins used in your website, there are more chances of security vulnerability if you don’t keep them updated. So it is best practice to keep your WordPress site and plugins updated and hide your version number.

Steps to Remove WordPress Version Number Easily

There are various places where the WordPress version might be exposed. So WordPress version number can be removed from following three locations:

  1. from WordPress Header section
  2. from Scripts and CSS
  3. from RSS Feed
Removing WordPress Version Number from Header Section

The head section is the most common place for lot of attackers to look at. So removing version number from the header discourages a lot of them. There is wp_head() located in your theme’s header.php file within the <head> section. Whenever the wp_head() is called it executes wp_generator() function

Steps to Remove WordPress Version Number Easily

When you right-click and view source of a WordPress site like this,

Steps to Remove WordPress Version Number Easily

You can see the meta tag that carries the version number, which is generated by the wp_generator() function.

Steps to Remove WordPress Version Number Easily

So, here are the steps to remove WordPress version number from Header section. All you need to do is to add following few lines of code in the function.php file. In the WordPress Dashboard go to Appearance > Editor

Steps to Remove WordPress Version Number Easily

On the right side among the list files choose function.php. Paste the following code in the very top of function.php file inside PHP tag or wherever you normally place custom code.

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

After you update the file, this removes the WordPress version number from generator tag in the head as well as from RSS feed.

Also Read:   Fixing HTTP Error When Uploading Images in WordPress

Removing WordPress version number from Scripts and CSS 

If JavaScript code or a CSS stylesheet doesn’t specify its own version number, it appends the WordPress version number.

4. version number in css

Even if you remove version number from header,  version number is still being displayed by your css and js files.

To remove them completely write few more lines of codes in function.php file.

// Remove WP Version From Styles	
add_filter( 'style_loader_src', 'sdt_remove_ver_css_js', 9999 );
// Remove WP Version From Scripts
add_filter( 'script_loader_src', 'sdt_remove_ver_css_js', 9999 );

// Function to remove version numbers
function sdt_remove_ver_css_js( $src ) {
	if ( strpos( $src, 'ver=' ) )
		$src = remove_query_arg( 'ver', $src );
	return $src;
}

Adding these codes will make sure that the WordPress version number is vanished completely from your source code.

Removing version number from RSS feed

The RSS feed is the next place that contains the version number. If you follow the previous steps to remove WordPress version number from head section correctly, version number from RSS feed will also be gone. To make sure your version number is gone; you can go back to page source code following the above mentioned steps. And search for your version number.

Steps to Remove WordPress Version Number Easily

If you don’t find any search result. You have successfully removed WordPress version number from your source code. In this way you can secure your WordPress site by hiding version number.

The following two tabs change content below.
Kantiman Bajracharya

Kantiman Bajracharya

Kantiman Bajracharya is a freelance web developer. He is a computer geek who has a Bachelor’s degree in Computer Engineering. He has earned lots of satisfied customers while working for numerous successful projects. He is also a WordPress theme creator and web article writer. On free time he likes reading philosophy books, traveling and playing chess.

Share This Post