How to remove WordPress version from source code

You can easily find out what version of WordPress your website is using from the page’s source code. To do this, right-click on the page in your browser and select “View page source.” You can then easily locate the line that shows the public version of WordPress, which is the line that reads <meta name=”generator” content=”WordPress x.x” />. Simply replace the x’s with your current version of WordPress. However, for security reasons, it’s better if your WordPress version is not visible. This is because if you’re not using the latest version of WordPress, you’re advertising to potential attackers that you’re using an outdated version with known vulnerabilities. Let’s take a look at how to remove the WordPress version from the source code.

How to remove the WordPress version from the source code

The only tool you need to accomplish this is a plugin that allows you to insert your own code into your website. Personally, I use the WPCode plugin, which is available in the official WordPress repository. You can easily install it from the “Plugins” link in the left-hand menu of your WordPress dashboard. For a complete guide on how to insert your own code into WordPress, click here: How to insert custom codes into WordPress.

WPCode is a small and lightweight plugin that won’t slow down your system. It’s useful whenever you need to modify your website using inserted codes. One plugin can replace several others. WPCode should be included in the arsenal of anyone who needs to modify WordPress functions using external code snippets.

PHP code to remove the WordPress version from the source code

To use WPCode, create a new basic snippet and select PHP as the snippet language. Then, copy the following code into the field for inserting code:

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

Save and activate the snippet. If you have a caching plugin installed on your website, you will need to clear it to see the inserted code take effect on the website. You can see the difference between using the snippet and not using it here:

How to remove WordPress version from source code
How to remove WordPress version from source code

As you can see, the first image clearly defines the version of your CMS in the page source code. In this case, it’s version 6.2. In the second image, where the above-mentioned snippet was used, the system version is already missing. The line is empty.


WordPress security is crucial and should not be underestimated. On the one hand, hiding the WordPress version may seem like a trivial matter. And maybe it is, in this context. However, it is one of many minor modifications that will contribute to the overall security of your website. And if there are 5 of these minor modifications, they become a rather interesting package of tweaks that contribute to the overall security of your website.

More content about WordPress

Whole category is here

Byl pro Vás tento článek užitečný?

Klikni na počet hvězd pro hlasování.

Průměrné hodnocení. 0 / 5. Počet hlasování: 0

Zatím nehodnoceno! Buďte první

Jak užitečný vidíte tento článek.

Sledujte mě na sociálních médiích.

Je mi líto, že pro Vás nebyl článek užitečný.

Jak mohu vylepšit článek?

Řekněte mi, jak jej mohu zlepšit.

Upozornit na
0 Komentáře/ů
Vložené zpětné vazby.
Zobrazit všechny komentáře.

Pokud mi chcete napsat rychlou zprávu, využije, prosím, níže uvedený
kontaktní formulář. Děkuji.

Další Kontaktní údaje