WordPress as framework

To run a plugin only when it is needed the plugin author has to identify the pages where the code actually does something. WordPress offers a surprisingly simple way to do that: the global variable $pagenow. It is set before a plugin is called in wp-includes/vars.php. In a spam block plugin I have written recently … Read more

accessing parent variables in child construct without executing action in parent

I think your problem is the pattern. You should not create a child class of your controller (the main class), and the controller should not handle action callbacks. Let the controller assign the callbacks to actions. The action handlers should be separate classes. Basic example: namespace WPSE; add_action( ‘plugins_loaded’, function() { new Controller; }); class … Read more