• Resolved sdwareham

    (@sdwareham)


    I have some situations where I need to disable this action added from this plugin:

    add_action( 'wp_head', array( $this, 'inject_script' ), - 1000 );

    I’m not quite sure how to use remove_action with this, as I’m not sure how to get the instance.

    remove_action( 'wp_head', array( 'Optimizely_X\Frontend', 'inject_script' ), - 1000 ); doesn’t seem to work. I think I need to be able to get the instance of $this to use in the remove_action function.

    Would anyone have any advice on how I can remove this action?

    • This topic was modified 5 years, 1 month ago by sdwareham.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sdwareham

    (@sdwareham)

    I have also tried this which also doesn’t seem to work:

    remove_action( 'wp_head', array( 'Optimizely_X\Frontend::instance()', 'inject_script' ), - 1000 );

    Thread Starter sdwareham

    (@sdwareham)

    OK, I think I got it.

    remove_action( 'wp_head', array( Optimizely_X\Frontend::instance(), 'inject_script'), - 1000 );

    appears to work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Removing the action that injects the script in the head’ is closed to new replies.