[wp-hackers] What's the best way of knowing which wordpress event to hook into?
frank at bueltge.de
Fri Jan 18 22:03:39 UTC 2013
You can also use the plugin Debug Objects, list all hooks and functions,
class to the hook. more comfortable as read the var.
Am 18.01.2013 22:09 schrieb "Haluk Karamete" <halukkaramete at gmail.com>:
> You are right. I should have thought about the do_actions.
> I also found this which is pretty useful. Sharing for those who need it.
> thanks for the pointer...
> On Fri, Jan 18, 2013 at 12:44 PM, Dobri <dyordan1 at ramapo.edu> wrote:
> > Hey there!
> > Out of curiosity I checked and, if you look at the definition of the
> do_action function, you can see the following line:
> > * @global array $wp_actions Increments the amount of times action was
> > That's actually fairly obvious once you look at the code of the function
> itself, but whatever. Just a wild guess, you can probably hook to the
> shutdown hook and just save the value of this global array to database/flat
> file/whatever and then look at it later. Treat it like a hook log, no?
> > On Fri, 18 Jan 2013, at 3:25 PM, Haluk Karamete wrote:
> >> 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 ).
> >> _______________________________________________
> >> wp-hackers mailing list
> >> wp-hackers at lists.automattic.com
> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> > ~Dobri
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers