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
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
- wp-hooks-filters-flow.txt: save and rename as .php
- wp-hooks-filters-flow.php: cut and paste into a blank file (this is colorized HTML, not raw code, do not download and run as is)
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
This page "WordPress Hooks & Filters Flow" was posted on 16/05/2006 at 9:38 pm
Watch this discussion : Comments RSS 2.0.