I've recently been exploring the event-driven design and how WordPress tries to implement it and I understand now that this is done through action hooks & filters, which make sense conceptually, but not with the code I've seen so far.

Would a question like this work for the Stack?

"Does WordPress implement callbacks for action hooks?"

The details would be a refer to the Codex and a bit of my own code of what I've been exploring so far.

The problem is that, while there are many articles on explaining how to do actions and hook into them, almost none explain the under-the-hood.

Yes, I think how core works is a great subject for a question, but I do think the example given may not be the best approach

"Does WordPress implement callbacks for action hooks?"

It would be very tempting to give a one word answer of "No", then have to elaborate on why it isn't in order to make the answer long enough to post.

It's a valid question, but other versions of the question would yield more information. By digging down, fundamentally, it's asking how action hooks work, so this question would yield more informative answers:

How do Actions/Hooks call code?

Which means I now have a trivial way of talking about:

  • How WP stores actions
  • How actions are used
  • PHP callables
  • That filters are the same system essentially

Some of those items are unrelated to the first question, yet they're clearly of interest

Consequently there are plenty of other questions that could be asked. The fundamental point though is:

Does my question require knowledge of WordPress to answer?

A lot of off-topic or out of scope questions fail this, be it because somebody is building something and has a generic PHP question, and it just happens to be on a WordPress site. Or somebody has a jQuery issue with a script, but by coincidence the site that generated the markup was WordPress. These situations don't require WP knowledge and could just as easily be answered by a Laravel developer, or a React developer who used jQuery respectively.

On the flipside, asking how to register a filter with a function that requires state would be on topic, via the solution of an object or closure and how to use add_filter in conjunction. Or how to use backbone to add extra views to the media library UI, etc Those require knowledge of WP to answer in full

Do you need WP knowledge to answer questions about how WP works? Yes

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .