title: Replace/Overwrite wordpress plugin class function
body: <p>I am trying to replace or overwrite an action hook declared inside a wordpress plugin class</p>
  <pre><code>class WCFM_Withdrawal {
  
      public function __construct() {
          global $WCFM;
              
              // WCFMu Thirdparty Ajax Controller
              add_action( 'after_wcfm_ajax_controller', array( &amp;$this, 'wcfm_withdrawal_ajax_controller' ) );
              
  
          
      } 
  </code></pre>
  <p>Here the add_action hook which points the function. I want to replace <em>&quot;wcfm_withdrawal_ajax_controller&quot;</em> with my own function.</p>
  <pre><code>add_action(&quot;init&quot;, 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
  }
  </code></pre>
  <p>i have tried to remove_action and add my own function, but didn't work.</p>