admin管理员组文章数量:1420907
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 );
本文标签: phpHow do I remove an action hook inside a class that is called by another class
版权声明:本文标题:php - How do I remove an action hook inside a class that is called by another class? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745346417a2654502.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论