I am trying to replace or overwrite an action hook declared inside a wordpress plugin class
class WCFM_Withdrawal {
public function __construct() {
global $WCFM;
// WCFMu Thirdparty Ajax Controller
add_action( 'after_wcfm_ajax_controller', array( &$this, 'wcfm_withdrawal_ajax_controller' ) );
}
Here the add_action hook which points the function. I want to replace "wcfm_withdrawal_ajax_controller" with my own function.
add_action("init", function () {
// removing the woocommerce hook
global $WCFM;
remove_action( 'after_wcfm_ajax_controller', array( $WCFM, 'wcfm_withdrawal_ajax_controller' ) );
});
add_action( 'after_wcfm_ajax_controller', 'my_new_function' );
function my_new_function(){
//Do something here
}
i have tried to remove_action and add my own function, but didn't work.