Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've recently started using the Hikari Hooks plugin for Wordpress as it seems to allow you to get a good idea of what do_actions are being called on the page, so that you can easily find out where potential hooks for plugin code might lie.

Are there better tools/plugins for accomplishing the same thing?

In particular I was looking for one that might notify me of post status transition actions such as new_to_publish and draft_to_publish...It appears that Hikari Hooks does notify you of such changes but not that they are available, only if you're already added them as an action.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

It is usually easy to find most hooks in documentation or source. It can be much more tricky for hooks that are dynamically generated, like post transitions. Essentially it doesn't exist in source as specific hook - it is hook that is getting generated dynamically at runtime, depending on variables.

do_action("${old_status}_to_$new_status", $post);
do_action("${new_status}_$post->post_type", $post->ID, $post);

At local test stack I often just add var_dump() on variables to source code to see what is going on. Dirty, but easy and fast. Obviously highly not recommended for production environment.

share|improve this answer
    
+1 - I tend to do exactly the same myself, i just use print_r in place of var_dump i find the data easier to read that way. Even wrapped it into a function so i can do this(it's quick to type) ... pre( $whatever ); –  t31os Feb 2 '11 at 12:12
    
@t31os Xdebug upgrades var_dump to very tricked out version –  Rarst Feb 2 '11 at 14:25
    
Took a little figuring out(local server app uses some funky setup with the ini's), but i managed to get xDebug working on the local installation, awesome! Thanks for the pointing that out... :) –  t31os Feb 2 '11 at 15:19
add comment

Hi @leeand00:

Note sure if this is a better way but I wrote a plugin to display the active hook on a page for this answer:

share|improve this answer
add comment

Less of a tool and more of a reference, the Plugin API/Filter Reference is a great list and it's sorted by type.

share|improve this answer
    
I came across this earlier, but it doesn't seem to cover the post state transition actions (such as new_to_publish) which appear to return a post object rather than a post_id (but I'm not sure this is the case all the time) –  leeand00 Feb 2 '11 at 5:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.