[Snippet] Remove WooCommerce generator tags

Another  security through obscurity post. WooCommerce leaves a generator meta tag showing it’s version number – I don’t like that.
[codesyntax lang=”html4strict”]
<meta name=”generator” content=”WooCommerce 2.0.14″>
Here’s a function to remove it. Place it in functions.php
function my_woocommerce_loaded_function() {
  global $woocommerce;
 
  // remove WC generator tag from &lt;head&gt;
  remove_action( 'wp_head', array( $woocommerce, 'generator' )   );
}
 
// called only after woocommerce has finished loading
add_action( 'woocommerce_init', 'my_woocommerce_loaded_function' );

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

Leave a Reply

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