Hikari Hooks Troubleshooter
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 do_action("action_tag");
and $content = apply_filters("filter_tag",$content);
. Plugin developers know them better, we love to hook actions and filters as add_action("action_tag","prefix_function");
and add_filter("filter_tag","prefix_function");
.
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
- Summary
- Introduction
- Features
- ScreenShots
- Download
- Donate
- Installation
- Upgrading and Uninstalling
- Support & Requests
- Frequently Asked Questions
- Versions
- To-do stuff
- Thanks
- Related Posts
- Comments (0)
Introduction
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.
Features
- 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
ScreenShots
- 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!!
License
© 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.
Download
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).
Donate
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
Installation
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/plugins
folder. Make sure the plugin has its own folder (for exemple/wp-content/plugins/hikari-hooks/
). - Activate the plugin through the 'Plugins' menu in WordPress admin page.
- Instantly the window will start appearing, by default only for administrators (
'edit_plugins'
capability) - 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.
FAQ
-
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.
Cangelog
- 0.01
- First public release.
Known bugs
- none ATM
To-do stuff
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
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 .
Popularity: 13%
It has accumulated a total of 36,457 views. You can follow any comments to this article through the Comments RSS 2.0 Feed. You can leave a comment, or trackback from your own site.
Related Posts:
- Wordpress
- Finding theme folders for parent and child
- How is Wordpress winning the war?
- Hikari Unicornified Gravatars
- Wordpress comments: new built-in feature X Wordpress…
- Hikari Featured Comments
- Hikari Internal Links - Exemples
- Hikari Email & URL Obfuscator - JavaScript markup
- Hikari Email & URL Obfuscator
- Hikari Internal Links
Comentando vc contribui e participa na criação do conteúdo do site.
Contribua. Commente. :)
(Os comentários abaixo representam a opinião dos visitantes, o autor do site não se responsabiliza por quaisquer consequências e/ou danos que eles venham a provocar.)