How does WordPress ensure plugins run at the same time and how does it solve a plugin’s dependency on another one?

Say I have a plugin which fires the plugin_1_action when it initializes.

Now, because I wanna extend that plugin, I’ll hook into plugin_1_action, but what if my plugin was installed after that plugin? Won’t that plugin run first and so, I’ll lose the chance to catch the plugin_1_action hook?

It’s just weird and magical to me that I can, no matter what, hook into, say, Woo’s actions and Woo can hook into mine, even if clearly my plugin has been installed later than it.

Even if most plugins run on the init hook (so they get executed on the same space), they still have priorities set differently. Meaning that plugin1’s code will run before plugin2’s code and if plugin2 has a hook into plugin1, well, tough luck…or not, apparently WordPress doesn’t have this issue.

How does it work?

Read more here:: How does WordPress ensure plugins run at the same time and how does it solve a plugin’s dependency on another one?

Leave a Reply

Your email address will not be published. Required fields are marked *