Plugin Architecture/Design Pattern – is better to use a private Observer/Mediator Pattern for plugin subclasses or WP add_action?

I’m wondering if i should refactor my
plugin using a ‘private’
Observer/Mediator pattern ie. collect
all relevant add_actions to my parent
class only and baking up a pattern to
notify/forward subclasses of events,
reducing the impact of my plugin to WP
event ques.

The event queue is fundamental to WP, so it’s pretty fast and getting faster all the time.

So, I don’t think it makes any sense, performance wise, to make your own sub-queues.

Refactoring your code so that you don’t have to make each add_action() call manually is a different matter.

Leave a Comment