[wp-hackers] What's the best way of knowing which wordpress event to hook into?

Haluk Karamete halukkaramete at gmail.com
Fri Jan 18 20:25:58 UTC 2013

Good morning!

Say, you wanted to carry out some action when you click on the publish
post button when creating a new post. For the sake of an example,
let's say you wanted an email to be automatically sent to somebody
everytime you create a post.

The question is what's the best way to know which core functions are
available to hook into - to carry out the emailing.

Or is it that, you kind of guess it - relying strictly on your
WordPress API memory? For example, you could think that since this
action has to do with creating a post, you should search for function
names in the plugin/actions codex page containing the word post in
them and then scan them thru to perhaps pick up items such as
wp_insert_post, wp_update_post, save_post, post_X, X_post etc etc? Is
this the norm?

For this particular case, you will probably ending up with either
wp_insert_post or save_post. But my question is general. Is this the
right way to approach to the problem?

Or.. is there another or more efficient way ( perhaps a plug in ) to
let me know which ( hookable) core functions have run in the current
or in the previous request? This way, I could get a definitive list of
all the related functions for me to choose from or read about which
are directly dealing with the current request that I'm interested in.
No more guess work...

note that because of the header redirects, current request may not cut
it, you would need to be able to get a list of all hookable functions
in the previous request. ( the one that just has run before the
redirect code was encountered ).


More information about the wp-hackers mailing list