first I did my homework by checking the answer on this question and this question, both didn't work.
after long debuging the function I want to remove is protected in 2 nested classes, and follows this path:

class Sub_class{
    function __construct(){
        add_action('my_action_name',array(&$this, 'the_hated_function'), 200);
    function the_hated_function(){
        // does some bs
class Mother_class{
    public $my_propreity;
    function __construct(){
        add_action( 'init', array( &$this, 'init' ), 10 );
    function init(){
        if(/* condition */ true){
            $this->my_propreity = new Sub_class();

so am trying to remove the hated function from a theme am creating.
for what it's worth the plugin is availabe in the wordpress market place directory WCFM - WooCommerce Frontend Manager. the action hook is end_wcfm_products_manage and the hated function is wcfm_custom_field_products_manage_views.
am well aware the remove should happen after the function was added and before the hook is fired. and that the order number should also be considered (10 and 200) otherwise it wont work.
thank you all for your help.

  • Where/how is Mother_class instantiated? May 16, 2021 at 16:17
  • Mother_class is instantiated on the plugin php file with the header comments, and stored in a global variable ( global $WCFM = new Mother_class(); )
    – user101018
    May 16, 2021 at 16:49

1 Answer 1


Sounds like you could try the remove_action() function. Make sure to execute it after the action for "the hated function" is added.

  • you know what. my bad, I thought it's obvious that's the function used. let me edit the question and put it there
    – user101018
    May 16, 2021 at 16:14
  • @amine Did you read what I linked? Specifically, this comment? "If an action has been added from within a class, for example by a plugin, removing it will require accessing the class through a variable that holds the class instance." Did you try this? May 16, 2021 at 16:49
  • yes I did (btw I wasnt the one who downvoted you) however the action wasn't simply added in a class, but in a subclass (a class instansiated fron another class, in a super similar fashion to the code I wrote above)
    – user101018
    May 16, 2021 at 16:54
  • A subclass is a class nevertheless, so if you have access to the instance of the subclass, you should be able to remove the action. And even if you don't have access to the instance, there is a way to remove the action. Excuse me possibly kicking in open doors—I am not sure what you have and what you have not tried, and whether your efforts contain errors that might be causing your issue. May 16, 2021 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.