Remove WooCommerce Generator Tag in Version 2.1.0 +

Remove WooCommerce Generator Tag

WooCommerce Generator Tag

Before Woocommerce 2.1.0 , we put the following code in functions.php file under active theme folder to remove generator meta tag:

//Remove WooCommerce Generator Tag
function remove_woo_commerce_generator_tag()
{
    remove_action('wp_head',array($GLOBALS['woocommerce'], 'generator'));
}
add_action('get_header','remove_woo_commerce_generator_tag');

With the release of Woocommerce 2.1.0, things have changed.

Here is new working code:

//Remove WooCommerce Generator Tag
function remove_woo_commerce_generator_tag()
{
    remove_action('wp_head','wc_generator_tag');
}
add_action('get_header','remove_woo_commerce_generator_tag');

  6Comments

  1. seanph   •  

    i think its not working anymore for 2.2.6
    can you pls confirm – thanks

  2. Jeffreyd00   •  

    It seems to have stopped working with WC 2.2.2

    • Jeriff Cheng   •     Author

      Yes, it still works ! check my blog, I’m using the latest version of Woocommerce

  3. JackLee   •  

    I think the correct method is:
    function remove_woo_commerce_generator_tag(){
    remove_action( ‘get_the_generator_html’, ‘wc_generator_tag’, 10 );
    remove_action( ‘get_the_generator_xhtml’, ‘wc_generator_tag’, 10 );
    }
    add_action(‘get_header’,’remove_woo_commerce_generator_tag’);

    • JackLee   •  

      The above code has be tested in Woocommerce 2.1.7.
      Relevant information:includes/wc-template_hooks.php
      /**
      * WP Header
      *
      * @see wc_products_rss_feed()
      * @see wc_generator_tag()
      */
      add_action( ‘wp_head’, ‘wc_products_rss_feed’ );
      add_action( ‘get_the_generator_html’, ‘wc_generator_tag’, 10, 2 );
      add_action( ‘get_the_generator_xhtml’, ‘wc_generator_tag’, 10, 2 );

  4. JADE Computer   •  

    Worked! Yours was the third try, but first *working* solution for the new woocommerce 2.1.2
    Thanks for this Cheng!

    Jim @ JADE

Leave a Reply

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