Remove the generator tag from the WordPress website

Since you’re reading this post, you probably already know that WordPress adds a meta tag generator to all websites by default. The generator tag tells us the version of WordPress used to generate and manage the website content.

All website owners using WordPress should definitely know which version they are using. However, there are many other ways to check the version of WordPress currently installed on your website. The problem with the meta generator tag is that it makes WordPress version information publicly available.

WordPress generator tagWordPress generator tag

Someone with malicious intent can then use this information to exploit known vulnerabilities in the specific release. Therefore, it makes sense to remove the generator tag from your WordPress websites. In this tutorial, I’m going to show you exactly how to easily delete the WordPress generator tag.

Remove plugin free WordPress generator tag

Before we jump straight into the removal process, let’s first try to understand how the tag is added to the WordPress source code.

The generator tag is added to the source with the help of wp_generator() function that is called using the wp_head hook. There are many other functions called behind the hook after the initial call to wp_generator() function. However, they won’t be a problem if we break the chain of function calls at the beginning.

WordPress core files are based on the wp_head hook to call a bunch of other functions. One such function is the wp_generator() function. The line responsible for adding the callback to this function is:

Now, we can undo the effect of the file add_action() call with the help of a remove_action() call that looks like this:

The line above needed to be added to the file functions.php your theme file. The WordPress generator tag will be removed from any website that uses the above line. Here is a screenshot of the page source with this line added to my theme’s one functions.php file:

No WordPress generator tagsNo WordPress generator tagsNo WordPress generator tags

Removing the WordPress generator tag with a plugin

Just like most other things, you can also find a plugin in the WordPress directory that can strip the WordPress generator tag. Here are the steps you need to follow:

Look for the Meta Generator and Version Info Remover plugin in the WordPress directory.

WP Generator Removal PluginWP Generator Removal PluginWP Generator Removal Plugin

Install and activate the plugin.

Navigate to Settings > Meta Generator and Remove Version Information option from the main navigation in your WordPress admin dashboard. You should see some checkbox options like the image below.

WP Generator Tag Remover plugin optionsWP Generator Tag Remover plugin optionsWP Generator Tag Remover plugin options

They will all be selected by default. A check against the first titled option Remove the default WordPress meta generator tag will delete the generator tag from you. There are many other options that remove version information for a variety of plug-ins.

After selecting the relevant options, click on Save your changes button at the bottom of the plugin page.

Final thoughts

After following the steps listed in any of these sections, you will be able to remove the generator tag from your WordPress website.

Source link

By LocalBizWebsiteDesign

Leave a Reply

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