title: How to Unhook actions/filters in within Class in plugin
body: <p>I have a business website for vacation home rentals in which the WordPress theme has its own booking system for house bookings only and it has been great!</p>
  
  <p>I also, have Tour/Services (not Houses) also bookable but for these I use WooCommerce/WooCommerce Bookings plugins, not the House booking system.</p>
  
  <p>Everything has been great!</p>
  
  <p>But recently the theme update introduced a WooCommerce checkout option for the Home booking system which never existed prior to the update. Although I have the themes WooCommerce checkout option turned OFF, the code is still being executed in the theme's core plugin. I have been going back and forth with an open support ticket with the theme provider for a few weeks for them to put a conditional statement to NOT run the new code when the user has the option turned OFF but I do not know when or if it will ever be done. What happens now is that the theme's core plugin is manipulating the WooCommerce checkout and after the final step of placing the order of any Tour/Services in which I had always been previously using WooCommerce separately now times out after placing the order and generates over 1,000 additional "Phantom" Checkout pages in the back-end.</p>
  
  <p><strong>Bottom line:</strong>
  When 3 lines (lines 27-29) are commented out of the theme's core plugin file, everything works fine. But I do not want to have to comment out these 3 lines after each plugin update.</p>
  
  <pre><code>//add_action( 'woocommerce_thankyou', array($this,'order_attach') );
  
  //add_filter( 'woocommerce_checkout_fields', array($this,'custom_override_checkout_fields') );
  
  //add_filter('woocommerce_create_account_default_checked', '__return_true');
  </code></pre>
  
  <p>Here is the full code (with lines 27-29 commented out): <a href="https://pastebin.com/jqtBpCpA" rel="nofollow noreferrer">https://pastebin.com/jqtBpCpA</a></p>
  
  <p>I have tried the instructions on both pages below without success:
  <a href="https://mekshq.com/remove-wordpress-action-filter-class" rel="nofollow noreferrer">https://mekshq.com/remove-wordpress-action-filter-class</a>
  <a href="https://github.com/herewithme/wp-filters-extras" rel="nofollow noreferrer">https://github.com/herewithme/wp-filters-extras</a></p>
  
  <p>I have inserted the following into the functions.php file</p>
  
  <p><strong>METHOD 1</strong>:</p>
  
  <pre><code>global $Wpestate_Global_Payments; //get access to the class object instance
  
  remove_action( 'woocommerce_thankyou', array($Wpestate_Global_Payments,'order_attach') );
  remove_filter( 'woocommerce_checkout_fields', array($Wpestate_Global_Payments,'custom_override_checkout_fields') ); 
  remove_filter('woocommerce_create_account_default_checked', '__return_true');
  </code></pre>
  
  <p>Then using the plugin, here: <a href="https://github.com/herewithme/wp-filters-extras" rel="nofollow noreferrer">https://github.com/herewithme/wp-filters-extras</a>
  I tried both methods:</p>
  
  <p><strong>METHOD 2:</strong></p>
  
  <pre><code>remove_filters_with_method_name( 'woocommerce_thankyou', 'order_attach' );
  remove_filters_with_method_name( 'woocommerce_checkout_fields', 'custom_override_checkout_fields' );
  remove_filters_with_method_name( 'woocommerce_create_account_default_checked', '__return_true' );
  </code></pre>
  
  <p><strong>METHOD 3:</strong></p>
  
  <pre><code>remove_filters_for_anonymous_class( 'woocommerce_thankyou', 'Wpestate_Global_Payments', 'order_attach' );
  remove_filters_for_anonymous_class( 'woocommerce_checkout_fields', 'Wpestate_Global_Payments', 'custom_override_checkout_fields' );
  remove_filters_for_anonymous_class( 'woocommerce_create_account_default_checked', 'Wpestate_Global_Payments', '__return_true' );
  </code></pre>
  
  <pre><code>class Wpestate_Global_Payments {
  
      public $stripe_payments;
      public $is_woo;  
      public $userID;
      public $user_email;
  
      function __construct() {
  
          $this-&gt;is_woo   =   wprentals_get_option('wp_estate_enable_woo','') ;
          $current_user   =   wp_get_current_user();
  
          $this-&gt;userID                  =    $current_user-&gt;ID;
          $this-&gt;user_email              =    $current_user-&gt;user_email;
          add_filter( 'woocommerce_cart_item_permalink','__return_false');
          add_action( 'wp_ajax_wpestate_woo_pay',                 array( $this, 'wpestate_woo_pay') );
          add_action( 'wp_ajax_mopriv_wpestate_woo_pay',          array( $this, 'wpestate_woo_pay') );
          add_filter( 'woocommerce_thankyou_order_received_text', array($this, 'wpestate_woocommerce_thankyou_order_received_text'),10,2 );
          add_action( 'woocommerce_before_single_product',        array($this, 'wpestate_product_redirect') );
          add_action( 'woocommerce_product_query',                array($this, 'wpestate_custom_pre_get_posts_query' ));  
          add_action( 'woocommerce_order_status_completed',       array($this, 'wpestate_payment_complete') );
          add_action( 'woocommerce_order_status_processing',      array($this, 'wpestate_payment_complete') );       
         //EVERYTHING WORKS ONLY WHEN THE 3 LINES BELOW ARE COMMENTED OUT 
         //add_action( 'woocommerce_thankyou', array($this,'order_attach') );
         //add_filter( 'woocommerce_checkout_fields', array($this,'custom_override_checkout_fields') );
         //add_filter('woocommerce_create_account_default_checked', '__return_true');
  </code></pre>
  
  <p>Can anyone provide any insight into how I can insert a remove_action &amp; remove_filter for each in the functions.php to remove/unhook the 3 actions/filters that I currently have commented out in the plugin file?</p>