How does WordPress implement hooks internally?
Basically, it maintains a global variable called $wp_filter to hold relevant data. Plugins can use functions like add_filter() to get themselves registered.
At various points (the hook points), wordpress examines $wp_filter to see if there are filters to run.
The easiest way to figure it out is to take a look at wp-includes/plugin.php and study the code there (or hook up a debugger and step through it, or set up firePHP and periodically dump stuff out)
I'm no expert, but I was curious, so I took a peek. If I really wanted to know more, I'd do what I just suggested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With