How To Remove Generator Meta Tag In WordPress — And Other Identifiers

Home » Blog » WordPress Development » How To Remove Generator Meta Tag In WordPress — And Other Identifiers

WordPress adds a meta tag to all the pages of your website. This meta tag looks something like this:

<meta name=”generator” content=”WordPress 6.0.1″ />

If you want to secure your WordPress website, you need to remove this. It tells hackers what software your website is running.

Fortunately, there’s an easy way to remove the generator meta tag in WordPress. I’ll also show you how to remove other identifier tags in this article.

How To Remove WordPress Generator Meta Tag

To remove the WordPress generator meta tag, simply add this snippet of code to your theme’s functions.php file:

remove_action('wp_head', 'wp_generator');

This will remove the wp_generator function from the wp_head hook. This is the function that generates the meta tag.

Tip: Use our plugin header generator to generate a starter plugin file. Then paste this code into it if you don’t want to put it in your theme’s function.php file. This way, your changes will survive even if you switch to a different WordPress theme.

How To Remove X-Powered-By Header

WordPress also adds an X-Powered-By header to all your pages. A header tells the browser details about the content it is receiving. These headers aren’t displayed to the user but they can be seen from the console tools.

Place this code snippet into your theme’s functions.php file to disable the X-Powered-By header:

// Remove X-Powered-By
function wpturbo_remove_x_powered_by() {
    if (function_exists('header_remove')) {
add_action('wp', 'wpturbo_remove_x_powered_by');

How To Remove WooCommerce Generator Tag

Removing the WooCommerce generator meta tag is as easy as removing the WordPress generator meta tag, and it only takes one line of code:

// Remove WooCommerce Version Generator Tag
remove_action( 'wp_head', 'wc_generator' );

The above code will remove the wc_generator function from the wp_head hook. This function is responsible for generating the generator meta tag for WooCommerce.


If you don’t want hackers to find out what software your site runs on, it’s important to disable the WordPress generator meta tag. And if you’re going to disable the generator tag for WordPress, you should also remove the WooCommerce generator meta tag and the X-Powered-By header.

Leave a Reply

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

Register an account to save your snippets or go Pro to get more features.