I’ve tried hard to find a way to not let plugin WPML output the following <meta name="generator" content="WPML ver:2.8.Best Answertt:3,1;0" /> tag in <head> via help of theme’s function.php:

It’s called in sitepress.class.php beginning with line 255

if ( !is_admin() ) {
    add_action( 'wp_head', array( $this, 'meta_generator_tag' ) );
}

This specific question has already been asked once in WPML forum.
I’ve tried:

/* ::: Disable WPML Meta Generator Tag ::: */
if ( ! is_admin() ) {
    remove_action( 'wp_head', 'meta_generator_tag', 20 );
}
add_filter( 'meta_generator_tag', 'theme_generator_tag' );

function theme_generator_tag() {
    return false;
}

— without success

2 s
2

The instance of this class is made global by WPML, so this should work:

if ( ! empty ( $GLOBALS['sitepress'] ) ) {
    add_action( 'wp_head', function()
    {
        remove_action(
            current_filter(),
            array ( $GLOBALS['sitepress'], 'meta_generator_tag' )
        );
    },
    0
    );
}

Leave a Reply

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