On: 2006/05/16
Shorter URL for this page: http://ozh.in/l3

Basically, a plugin for WordPress creates a PHP function (a filter or an action) which is called when a particular event (a hook) occurs, for example when a post is printed or when a comment is posted (for more info about hooks, filters and action, check the Codex)

When developping a new plugin, you sometimes encounter unexpected behaviors from your code, which can originate from a filter conflict : another PHP function with a higher priority was triggered before your own function, and processed the same bits you're trying to pass through your function.

That's why when developping plugins, it's important to be well aware of what I call the Filter Flow : for each hook, which functions are called in which order ?

So, I wrote this script : WordPress Hooks & Filters Flow

List hooks and current filters

Wordpress Hooks and Filters Flow The script runs in your WordPress root (or in /wp-admin/ if you prefer) and enumerates filters that are loaded in your blog. Hooks are displayed alphabetically, and for each hook, active filters (or actions, they're the same) are listed in their execution order, which is either defined by their priority or by their loading order. The purpose of such a list is to help hunt plugin bugs down, and let you wisely fine-tune plugin priorities if needed.

Get the script

Put the script in your wordpress root or in '/wp-admin/' and you're done.

Feedback

Only if it's to say "woohoo it's cool". No support or troubleshooting with your plugin problems. These are your plugin problems :)

Shorter URL

Want to share or tweet this page? Please use this short URL: http://ozh.in/l3

Metastuff

This page "WordPress Hooks & Filters Flow" was posted on 16/05/2006 at 9:38 pm
Watch this discussion : Comments RSS 2.0.

16 Blablas

  1. LetsBlogSpam says:

    Hey its iss great work, but If I can suggest, you need to hook a menu to admin somewhere, it will make easy and accessible for layman :)

  2. Massimo says:

    Useful tool! "woohoo it’s cool"…

  3. […] WordPress Hooks & Filters Flow ist kein PLugin, sondern ein kleines Script, welches dabei hilft Konflikte zwischen Plugins zu entdecken. Praktisch für Plugin- Entwickler. Bookmarks setzen: Diese Icons verlinken auf Bookmark Dienste bei denen Nutzer neue Inhalte finden und mit anderen teilen können. […]

  4. Cher says:

    Hi Ozh…
    I've only been developing with WordPress for a week or two. Your name comes up more often than anyone else when I'm googling something. I've gleaned a lot of good stuff from your contributions already. Thanks for that :)

    When I first saw this little debug app, I was thrilled. For a WordPress n00b it was just what I needed, however, I've been unable to get it to work. I changed the txt to php and after trying to install in both the wp root as well as the wp-admin folders, I get a page not found error. Is this script for wp versions prior to 2.7? I'm still learning about nonces and web security and thought that might have something to do with it.

    Thanks :)

  5. Ozh says:

    Cher: yeah I wrote this a looong time ago and never checked with newer versions. It might totally be wacked out :)

  6. Here is the updated version of it, to work with WordPress 3.0:

    http://wordpress.pastebin.com/YPmRqY3s

  7. Ozh says:

    Jonathan Dingman » wow, you've really digged into the old stuff :)

  8. David Jones says:

    Very useful tool, … except the script doesn't seem to work with WordPress 3.0.1 and/or with some of the plugins I have (e.g., wp-typography)

    The error occurs on line 62 when calling strlen($v), when $v is not a string.

    I tried adding these lines near line 62 to see what is going on.

    1. foreach ($func[0] as $k=>$v) {
    2.                     if (! is_string($v)) {
    3.                         echo '<b>$v is not a string</b>';
    4.                         echo ''; print_r($v) ; echo '';
    5.                         continue;
    6.                     }
    7.                     if (substr($v,strlen($v)-4,strlen($v)) == '.php') echo " ($k : $v)";
    8.                 }

    Send me email if you want more details to help track down the bug.

  9. Ozh says:

    David Jones » super outdated stuff here, not even sure it still works as expected

  10. ParanoidSardine says:

    I just used the pastebin link above and it worked perfectly on a 3.0.4 install! Thanks…this will be very handy!

  11. stav says:

    Thanks for the post. It helped me realize that I could increase the priority number of my plugin to make it run after the do_shortcode(). Great little script.

  12. Midhun Devasia says:

    Thats too cool…

  13. Rares says:

    If anyone is still interested in this, I made a WordPress 3.4 compatible version: GitHub Gist

  14. Garry says:

    Hey – does the latest work? I've tried dropping it in wp-admin or root and I see nothing happening…

  15. Ozh says:

    Garry » Dunno. It's 6 years old. Maybe. Dunno. :)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar and sign for a free account
Spam: Various spam plugins may be activated. I'll put pins in a Voodoo doll if you spam me.