php - How do I remove an action hook inside a class that is called by another class?

Okay, so I am using the "FooEvents for WooCommerce" plugin for making WooCommerce products to events.And now I

Okay, so I am using the "FooEvents for WooCommerce" plugin for making WooCommerce products to events.

And now I wanna replace their WooCommerce hook 'woocommerce_order_status_completed' with my own.

Their hook is placed in their class and method: FooEvents_Woo_Helper::_constructor()

And that class (FooEvents_Woo_Helper) is only called by a private variable, $this->WooHelper in another class, their "main class" FooEvents.

So FooEvents_Woo_Helper is called inside FooEvents public method plugin_init():

//WooHelper
require_once($this->Config->classPath.'woohelper.php');
$this->WooHelper = new FooEvents_Woo_Helper($this->Config);

Now, I learned in another question I asked earlier about a similar question, here: How to Remove a Filter from the Admin List Table?

And I tried to do the same thing here, in different ways. But I can't make it to work. What am I doing wrong?:

function my_own_init() {
    global $FooEvents;

    if ( $FooEvents instanceof FooEvents ) {
        remove_action( 'woocommerce_order_status_completed', array( $FooEvents->WooHelper, 'process_order_tickets' ) );

    }
}
add_action( 'init', 'my_own_init', 11 );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745346418a4623567.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信