The WordPress Hook Sniffer plugin is a tool for plugin developers that helps determine the sequence in which action and filter functions are fired. It allows you to peer into the inner workings of the WordPress Plugin API. You can configure what is outputted and to where the output is sent (screen or text file).
Since it’s not supported anymore from the original author, it’s now maintained by Mirco Babini, WordPress Consultant, Web Developer and Data Lover.
You can choose to output any or all of the six different sets of hook data that WordPress Hook Sniffer collects. Each dataset provides a unique insight into the underlying working of WordPress’ hooks. The currently available datasets are:
a listing of, in the order in which they were encountered during code execution, all add_action calls and add_filter calls
a listing of, in the order in which they were encountered during code execution, all remove_action calls and remove_filter calls
Action and Filter Function Array:
output the array that holds all of the added action and filter functions used by the do_action and apply_filters functions
Action Event Firing Order:
a sequential listing of all the do_action events that need to be processed
Action Event Firing Sequence:
a sequential listing of do_action events and their corresponding fired action function(s)
Filter Event Firing Sequence:
a sequential listing of apply_filters events with their corresponding fired filter function(s)
This plugin is to be used only in a development sandbox and not in a production environment.
This plugin is provided “as is.” It is free software licensed under the terms of the [GNU General Public License 3.0 (GPL)] (http://www.gnu.org/licenses/gpl.html “GNU General Public License 3.0”). It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. I am not liable for any damages or losses. Your only recourse is to stop using this plugin.
* license.txt – contains the GNU General Public License 3.0 (GPL) license
* known-bugs.txt – contains a listing of all currently-known bugs
- Why can’t I run this on my production site?
As mentioned in the Installation section of this readme file, this plugin should not be installed on an active WordPress-based site (a production site). There will be
no support for broken production sites. You have been warned! Of course, you can technically install this plugin on your production site if you wish to provide your site’s users with a screen full of text output that will confuse them!
- I don’t see anything? Where’s the output?
If you’ve selected
To Screenin the Output Location settings section, then look for the output to begin just below your theme’s footer. If you’ve selected the
To Fileoutput option, then look for the text file “wp-hook-sniff.txt” in the “hook-sniff-report” folder of the wordpress-hook-sniffer directory.
- I don’t understand what this plugin does?
To appreciate the value of this plugin, you must first have an understanding of WordPress action hooks and filter hooks. Also, experience in tying into hooks and modifying function output via action functions and filter functions is desirable. Once you have a solid working knowledge of WordPress’ Plugin API, you should then read my article, WordPress Hooks, Barbs, and Snags.
- Where do I report issues or provide suggestions on the WordPress Hook Sniffer plugin?
You are welcome to report issues or provide suggestions by adding a comment to this blog post. However, you are encouraged to participate in the plugin’s official support forum, hosted on BuddyPress.org.
This plugin has room for improvement!
It's completely broken, requires reinstalling WP to fix. No DB damage, as far as I can tell.
Activating this plugin will break your site and require reinstallation of WordPress.
- Aug 07, 2014
- Fixes errors on activation on WP3.9.2
- original plugin.php updated
- May 27, 2014
- Fixes errors on activation on WP3.9+
- July 21, 2013
- Fixes an issue in the modified plugin.php file where if the $the_[‘function’] variable is a Closure, a fatal error occurs.
- December 31, 2010
- Fixes an issue in the modified plugin.php file where if the $time_fired variable isn’t set, a non-critical error occurs (logged in PHP error log file). Props Paul Gibbs
- July 28, 2010
- Fixed a crucial bug with the modified plugin.php file that resulted in some important WordPress action hooks not firing
- Bumped required WordPress version to 3.0 as there are important differences between the /wp-includes/plugin.php files of WP 2.9.2 and WP 3.0
- Added the constant WP_HOOK_SNIFF_PLUGIN_API_VER to use as a check to make sure that the proper version of the modified plugin.php is installed
- Added a WordPress version check to make sure that WP Hook Sniffer is installed on the proper version of WordPress, if not plugin will install but not run. A warning message will be displayed in the Plugins directory
- Added a CSS file to improve proper code separation
- Renamed CSS selectors to make them unique to plugin
- Added functions that will automatically install the modified plugin.php file upon plugin activation and then reinstall the original, stock WP version of the /wp-includes/plugin.php file upon plugin deactivation.
- Generated a new .pot file as new translatable strings were added to the plugin
- July 8, 2010
- Fixed an issue when using WP Hook Sniffer with WP 3.0. The function apply_filters_ref_array() was added to plugin.php in version WP 3.0. This function is now included in the distributed, modified plugin.php file as well.
- Added action and filter hook sniffing functionality to the functions apply_filters_ref_array() and do_action_ref_array()
- May 3, 2010
- Added wp_hook_sniff_init_event action hook to allow functions that are dependent on the WP Hook Sniffer to hook into it in a safe manner
- Added a function to load the language file for Internationalization support
- Added a .pot file (located in the /languages directory) containing the plugin text that can be translated
- Corrected my boneheaded mistake where I submitted the plugin with the wrong name resulting in the actual plugin residing in a directory in the download file.
- Per above comment, the official plugin directory name has been changed to “wordpress-hook-sniffer” from “wp-hook-sniffer”.
- April 30, 2010
- Added link to the WordPress Hook Sniffer official support forum hosted on BuddyPress.org
- April 29, 2010
- Initial release