How can I remove a meta tag in WordPress?
More precisely the meta tag generator
created by Visual Composer .
<meta name="generator" content="Powered by Visual Composer - drag and drop page builder for WordPress."/>
How can I remove a meta tag in WordPress?
More precisely the meta tag generator
created by Visual Composer .
<meta name="generator" content="Powered by Visual Composer - drag and drop page builder for WordPress."/>
You need to find the hook responsible for printing this line in HTML. Usually, this is an action attached to wp_head
. After that, we use remove_action
or remove_filter
to remove the hook .
We will have to pay attention if the hook is inside another and what the priority of each one. If the plugin / theme uses something like this:
add_action( $nome_do_hook, $funcao_de_retorno, $prioridade, $parametros );
add_action( 'wp_head', 'funcao_de_retorno', 11, 2 );
The remove_action
will be:
remove_action( 'wp_head', 'funcao_de_retorno', 11 );
If the priority is 10
or is not declared, you do not have to put it because 10 is the default value. Parameters do not matter.
It gets a bit more complex when the plugin uses OOP. Some programmers leave the anonymous objects, causing this type of problem . But in the case of Visual Composer, it's easy to access the class:
add_action( 'init', function()
{
if( class_exists( 'WPBakeryVisualComposer') )
remove_action( 'wp_head', array( WPBakeryVisualComposer::getInstance(), 'addMetaData' ) );
}, 11 ); // <-- a prioridade padrão não teve efeito, usando uma menos importante deu certo
Searching for Powered by
within the plugin files, we see that this is added by $this->composer->addAction('wp_head', 'addMetaData');
, and that code is within init
with default priority.
The @brasofilo response was correct, however, it seems to have changed as cadastram the action and you need to change from:
remove_action( 'wp_head', array( WPBakeryVisualComposer::getInstance(), 'addMetaData' ) );
To:
remove_action('wp_head', array(visual_composer(), 'addMetaData'));
With me I made a mistake and found this solution in their support at CodeCanyon.