WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tried hard to find a way to not let plugin WPML output the following <meta name="generator" content="WPML ver:2.8.1 stt: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

share|improve this question

closed as off-topic by toscho Aug 10 '14 at 11:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

Should be closed. We can't look at the plugins source or test anything. – kaiser Oct 11 '13 at 8:22
Possibly a DUPLICATE OF THIS QUESTION - read answer to see the problem you're facing. – kaiser Oct 11 '13 at 8:23
up vote 6 down vote accepted

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

if ( ! empty ( $GLOBALS['sitepress'] ) ) {
    add_action( 'wp_head', function()
            array ( $GLOBALS['sitepress'], 'meta_generator_tag' )
share|improve this answer
That doesn't work on my server, it works locally for me though. Facing WP 3.6.1 on PHP 5.2.6-1 on the server and on PHP 5.3 locally. Getting Parse error: syntax error, unexpected T_FUNCTION back`. – Volker E. Oct 12 '13 at 9:27
Is your server’s PHP version up to date? It should be at least version 5.4. – toscho Oct 12 '13 at 9:28
You're amazingly fast ;) – Volker E. Oct 12 '13 at 9:31
Yes, create a named function and use that as callback. But why would you stay with an insecure, slow and outdated PHP version? – toscho Oct 12 '13 at 9:44
Well, I've been able to finally get rid of it by including remove_action( 'wp_head', array( $sitepress, 'meta_generator_tag', 20 ) ); in functions.php. – Volker E. Aug 10 '14 at 12:08

Try this (note different remove_action():

    remove_action( 'wp_head', array($sitepress, 'meta_generator_tag') );
add_filter( 'meta_generator_tag', 'theme_generator_tag' );

function theme_generator_tag() {
    return false;

It worked for versions and before, but not tested for newer ones.

share|improve this answer
Thanks for your input. First I thought it should be the array notation as well. But it doesn't work. :\ – Volker E. Oct 11 '13 at 7:14
I've found an old theme of mine where just one line was used in functions.php: remove_action( 'wp_head', array($sitepress, 'meta_generator_tag' ) );. – Max Yudin Oct 11 '13 at 7:46
Yeah, it shouldn't make to much difference. For me as administrator, I obviously should know which version of WPML I'm using. Still, it doesn't work. I also put in the add_filter to ensure meta_generator_tag isn't used. Could it be that it's not possible to override the function via theme's function.php (anymore, as of 2.8.1)? – Volker E. Oct 11 '13 at 8:10
The last idea is to add global $sitepress; before the code above. – Max Yudin Oct 11 '13 at 8:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.