• Resolved Dekadinious

    (@dekadinious)


    Can you please change the plugin code to either assign classes to variables or use static initiation?

    You are doing new CWG_Instock_Notifier_Product(); when it would be better to do $someName = new CWG_Instock_Notifier_Product(); or have a static init method and do CWG_Instock_Notifier_Product::init();.

    I need to use remove_action and remove_filter for actions added in this plugin in specific cases, and it is not possible when you are doing new CWG_Instock_Notifier_Product(); because the instantiated class is not accessible anywhere.

    See description of problem and solution: https://wordpress.stackexchange.com/questions/36013/remove-action-or-remove-filter-with-external-classes

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author CodeWooGeek

    (@codewoogeek)

    Hello there,

    We declared variable to the class in version 1.10.7, please update it and check it out.

    Thanks.

    Thread Starter Dekadinious

    (@dekadinious)

    Hello and thank you!

    The variable seems correct, but I still can’t remove the actions and filters the correct way for some reason. I needed to use an alternative way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Wrong way to instantiate classes’ is closed to new replies.