Closed joyously closed 3 years ago
It doesn't duplicate core, it makes core better :) because you don't need to pass array($object, 'method')
as is usually necessary when add_filter or add_action in OOP.
The loader does that for us, thus we can just pass $object.
This is the main reason I like it.
However, there seems to be as well more technical reasoning here https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/issues/248#issuecomment-68713041 about why this even exists.
I will leave this as it is.
Yes, it does duplicate core. You don't need to pass the array if you don't use a class, and this plugin is so small it shouldn't be a class. Therefore, the reasoning at that comment doesn't apply. The business logic of this plugin is, in fact, dealing with WordPress.
https://github.com/TukuToi/tkt-maintenance/blob/18c552f0089296be71e39d1c9521a61df0f6d6e1/includes/class-tkt-maintenance-loader.php#L16
This whole class is duplicating what already exists in core, so all it does is waste memory.