I've been developing Wordpress plugins for a few months, and I always felt challenging to know if those hooks I was using were being used by other plugins as well, and which were coming before and after my function.
Wordpress hooks are actions and filters. They are known by theme designers as those "things" that come in
$content = apply_filters("filter_tag",$content);. Plugin developers know them better, we love to hook actions and filters as
I just wanted something that, in any page I wanted, would show me a list of all hooks, everything hooked to each of them, and the priority order they were called.
Of course that couldn't be something like a static model designed by (my) hand, it should be something automatic, dynamic, related to each page. Something real, that showed what really happened during that particupar page load.
With some research I found codes that did that, and much more. I merged these codes together, improved them, and Hikari Hooks Troubleshooter was born
- Upgrading and Uninstalling
- Support & Requests
- Frequently Asked Questions
- To-do stuff
- Related Posts
- Comments (0)
Hikari Hooks Troubleshooter creates a draggable window with informations about Wordpress hooks. It lists all hooks (actions and filters) that have at least a function hooked to them, and for each hook there's a list of hooked functions, sorted by their priority!
The window is visible only to registered users, and you can choose who will be able to see it, and set if it should be visible or not. It works in Wordpress page, be it frontend or admin area.
When you are in an admin page, it also shows a list of special actions related to that specific page, helping plugin developers to attach features only to special admin pages, instead of the whole admin area! A list of all conditional tags is also available, informing which tags return true and which ones return false, for any page you want!
The list of conditional tags and hooks is based on Frank Bueltge (http://bueltge NULL.de)'s wp_view_type.php (http://bueltge NULL.de/wordpress-theme-debuggen/536/). The original code was translated from germany to english, and ported to a draggable window that can be moved inside the browser, minimized and closed.
The list of admin actions is based on Dustin Dempsey (http://playforward NULL.net)'s Show Page Hooks plugin, and a few more hooks were added.
- The plugin creates a window, that can be dragged, minimized and closed
- The window works both in website's admin panel and frontend
- You can choose who can see the window, while visitors never see it
The window presents many useful information for plugin developers:
- action and filter hooks, and functions hooked to them, sorted by the priority they are called
- all conditional tags, informing those returning true and those returning false
- all actions present in admin pages, that are specific to each page, so that we can hook features that we want to happen only on those specific pages
- actions that were run are flagged so, allowing you to know which actions are used in each specific page
- The begining of the draggable window, with the list of admin actions that's only shown in admin pages
- Conditional tags, here you can see in one place all tags that will return true in current page
- Begining of the huge list of actions and filters hooks
- The probably most popular hook, the all powerful
'the_content'filter, with part of the many functions hooked to it
- Another very popular hook, the
'wp_head'action, with the flag "ran", pointing out it was run in that page
- The end of the window, with wow 432 hooks! That's LARGE!!
© Copyright Hikari (http://wordpress.Hikari.ws), 2010
If you want to redistribute this software, please leave a link to this post together with it and mention me as its author
Parts of this code are provided or based on ideas and/or code written by others
Important contributors to this plugin (listed in alphabetical order):
- Dustin Dempsey (http://playforward NULL.net)
- Frank Bueltge (http://bueltge NULL.de/wordpress-theme-debuggen/536/)
- I wasn't able to find the original author of draggable window
If you want to extend the plugin features, please contact me so I can add your work to my official release.
You can follow Hikari Hooks Troubleshooter updates and older versions at Wordpress.org Plugin Directory (http://wordpress NULL.org/extend/plugins/hikari-hooks/), or you can get the last version from the direct link hikari-hooks.zip (http://downloads NULL.wordpress NULL.org/plugin/hikari-hooks NULL.zip).
There are also several ways you can show your appreciation:
- blogging about it
- linking it from your site (without using rel=nofollow )
- browsing the site sidebars
- suggesting it to your friends
- visiting other posts thru the site and adding valuable comments
- saying thanks on comments
- offering codes that add new features
- etc, use your imagination
Hikari Hooks Troubleshooter requires at least Wordpress 2.8 and PHP5 to work.
You can use the built in installer and upgrader, or you can install the plugin manually.
- Download the zip file, upload it to your server and extract all its content to your
/wp-content/pluginsfolder. Make sure the plugin has its own folder (for exemple
- Activate the plugin through the 'Plugins' menu in WordPress admin page.
- Instantly the window will start appearing, by default only for administrators (
- Go to plugin admin page and you can disable and reenable the window, and choose who is able to see it
Upgrading and Uninstalling
I consider very ambiguous the way some plugins should be upgraded and the proper way of uninstalling them, so I believe I should explicitly explain it for my plugins.
I've made an article just to explain in full details which options we have to upgrade and uninstall our plugins and what happens with each option, and how it works with my plugins: Uninstalling my plugins.
For upgrading, simply delete it and follow installation setps again.
Support & Requests
If you want to request any new feature, leave a comment on this post explaining it with as many details as possible. I can't assure it will be added, but if it is viable, I like it AND have the time, I'll do my best.
If something seems to not be working and you need help, first read the FAQ and then leave a comment explaining what's happening. If you need to post a picture, please link it instead of using an img tag.
Will my visitors see this reporting window? Should I use the plugin only in development environments?
Just logoff and you'll see. Unregistered users never see it, and you can choose which registered users can see it, based on Wordpress capability system.
Great, it lists hundreds of hooks... where are all others?
It only shows hooks that have at least 1 function hooked to them, it seems Wordpress is not aware of a hook until something is hooked to it.
How is the list sorted?
When a hook is run, functions hooked to it are called based in priority, assigned when the hooking is done; therefore, functions of a hook are listed based on this priority. The list of hooks seems to be random, I'm not sure.
Can't you separate actions and filters in the list? Why do you show actions that were run and don't show run filters?
Wordpress stores actions and filters in the same place, without distinguishing them. Indeed, in some codes Wordpress treats actions as filters!
The biggest difference from action to filter is that filters are required to pass at least a parameter (the content to be filtered) to functions hooked to them, and expect to receive a variable returned (the content, possibly altered by the filter), while actions aren't forced to pass parameters and never return a variable.
What really distinguish action from filter is the functions used to deal with them, which are different. And as I could learn, the only way Wordpress provides to find out if a hook is an action or a filter, is the function
did_action($action_tag). But even this function, it returns true if the hook is an action and was executed. If the hook is a filter, or if it's an unused action, the function returns false, so we can't even distinguish these 2 cases.
Of course I'm not a Wordpress hooks system expert, although I love it. If you know a better way to know if a hook is action or filter, and know if it was run, please contact me
Can't the state of the window be saved, so that it stops opening always in the same place, and I can move it to the place I want it to open?
The original code couldn't. I adapted the window to work inside FireFox's extension GreaseMonkey and implemented the feature. When I ported it to use in this plugin, I had to remove the feature because didn't have time to port the feature. I plan to make the port in the future, probably using cookies.
The window's height is absurdly large, can't you limit it and use some sliding bar?
I plan to enhance this draggable window, I just employed it in this project and it has some more nice feature that weren't used. When I have the time I wanna make some improvements that will make it easier to be ported and consumed by other developers, as a small lib. For now it's only an idea and I didn't wanna spend much time working on it for now.
There's a better way to list hooks. You are missing a conditional tag or an admin action.
Just contact me adding a comment and I'll add it. Any feature that may be useful I can add too.
- First public release.
- none ATM
Here are my ideas that I wish to implement in the future.
- Improve the draggable window
- Find a way to distinguish actions from filters
- Find a way to know when a filter was run
Thanks to Frank Bueltge and Dustin Dempsey, and everybody who helped me develop this plugin.
Again, thanks to Wordpress developers for its great hooks system!
And of course thanks to all of you that use my plugins, come to my sites and take something useful from it .