Stable tag: 1.0.0
Requires at least: 6.5
Tested up to: 6.5.2
Requires PHP: 7.4
License: GPLv3 or later
Contributors: tommcfarlin
Tags: developer
, debug
, tools
Renders contextual information about every function registered with all WordPress hooks.
This plugin renders contextual information about every function registered with all WordPress hooks.
Specifically, Callback Info looks at each hook used in the current WordPress instance including the active themes and plugins and renders:
- the name of the hook,
- the type of method (object, static, standard function, or anonymous),
- the file in which it's registered,
- the line on which the function starts,
- the line on which the function ends.
Callback Info was originally developed as a plugin to demonstrate certain concepts outlined in a series of blog posts. As the plugin became more advanced, I found it's functionality useful in my day-to-day work so decided to release it for others to use, too.
This should only be used in development environments.
Pull Requests, Feedback, Questions, Bug Reports, and Feature Requests are welcome to be posted on the GitHub Issues page.
- Visit the Plugins page from your WordPress dashboard and click "Add New" at the top of the page.
- Search for "callback-info" using the search bar on the right side.
- Click "Install Now" to install the plugin.
- After it's installed, click "Activate" to activate the plugin on your site.
- Navigate to any page on the front-end - any non-admin page - of your site.
- Once installed, add
?show-callback-info=true
to your query string to render contextual information.
- Download the plugin from WordPress.org or get the latest release from the Github Releases page.
- Unzip the downloaded archive.
- Upload the entire
tm-callback-info
folder to your/wp-content/plugins
directory. - Visit the Plugins page from your WordPress dashboard and look for the newly installed plugin.
- Click "Activate" to activate the plugin on your site.
- Navigate to any page on the front-end - any non-admin page - of your site.
- Once installed, add
?show-callback-info=true
to your query string to render contextual information.
Once the plugin is activated, navigate to a page on the front-end of your site (that is, do not try to run this plugin within the administration area of your WordPress installation).
Assuming that your domain is https://plugin.test
, append the query string ?show-callback-info=true
to your URL such that the address is https://plugin.test?show-callback-info=true
.
This will render all of the hooks along with each function that fires during that hook. Further, you'll see which file in which the function belongs as well as the starting line number and ending line number for the callback.
Since not all plugins nor themes use anonymous functions, it's not possible to see how this plugin will detect anonymous functions and provide feedback.
To see how this works, you can also append a second query string to your URL: ?use-sample-anonymous-function=true
. The full URL should look like this: https://plugin.test?show-callback-info=true&use-sample-anonymous-function=true
This will render a sample element at the bottom of the page (which you can view in the screenshot below) and you can see the anonymous function and its relevant information under the wp_enqueue_scripts
hook.
Note: This plugin is not designed to run in a production environment.
See the CHANGELOG.