Wrong way to instantiate classes
-
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 doCWG_Instock_Notifier_Product::init();
.I need to use
remove_action
andremove_filter
for actions added in this plugin in specific cases, and it is not possible when you are doingnew 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
- The topic ‘Wrong way to instantiate classes’ is closed to new replies.