• Resolved Redpik

    (@redpik)


    Hi,

    Is it possible to disable WTM4WP in a particular case ?
    I tried in a plugin :

    
    add_action( 'plugins_loaded', function() {
        if (my_special_case()) {
            remove_action( 'plugins_loaded', 'gtm4wp_init');
        }
    }, 99 );
    

    It doesn’t work.

    I tried in my theme, wrapped in ‘init’ and in ‘wp’ add_action.

    It doesn’t work.

    Thank you for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    You might want to hook into the gtm4wp_get_the_gtm_tag WP filter. It will get the GTM container code generated by GTM4WP as an argument, you can either manipulate or completely remove the code in your special cases.

    Thread Starter Redpik

    (@redpik)

    Hi Thomas,

    Thank you, it works ??
    Have a nice day.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘remove_action gtm4wp_init ?’ is closed to new replies.