On: 2006/05/16 Viewed: 20611 times
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. 1
    LetsBlogSpam China »
    said, on 11/May/07 at 3:00 pm # :

    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. 2
    WP Plugins DB » Plugin Details &ra... United States »
    pingback on 18/Jul/07 at 1:34 pm # :

    [...] Visit [...]

  3. 3
    Massimo Italy »
    commented, on 16/Jun/08 at 6:27 pm # :

    Useful tool! "woohoo it’s cool"…

  4. 4
    Wordpress Hooks & Filters Flow - WP ... Germany »
    pingback on 02/Oct/08 at 9:06 am # :

    [...] 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. [...]

  5. 5
    Cher United States »
    thought, on 12/Jun/09 at 11:56 pm # :

    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 :)

  6. 6
    Ozh France »
    thought, on 15/Jun/09 at 9:07 pm # :

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

  7. 7
    Jonathan Dingman United States »
    replied, on 25/Jun/10 at 7:14 pm # :

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

    http://wordpress.pastebin.com/YPmRqY3s

  8. 8
    Ozh France »
    said, on 26/Jun/10 at 10:37 am # :

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

  9. 9
    David Jones Canada »
    commented, on 23/Oct/10 at 7:54 pm # :

    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.

  10. 10
    Ozh France »
    thought, on 23/Oct/10 at 9:02 pm # :

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

  11. 11
    ParanoidSardine United States »
    replied, on 22/Jan/11 at 1:00 am # :

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

  12. 12
    stav Mexico »
    wrote, on 21/Feb/11 at 7:21 am # :

    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.

  13. 13
    Midhun Devasia India »
    thought, on 12/Oct/12 at 1:02 pm # :

    Thats too cool…

  14. 14
    Rares Romania »
    said, on 04/Nov/12 at 5:24 pm # :

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

  15. 15
    Garry United States »
    replied, on 18/Jan/13 at 7:12 pm # :

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

  16. 16
    Ozh »
    said, on 18/Jan/13 at 10:14 pm # :

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

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.