Generate a list of hooks used in your plugin or theme.
- Let's assume your plugin resides in
wp-content/plugins/example-plugin
. Create a folder namedtasks
at this path:wp-content/plugins/example-plugin/tasks
. You can do the same for themes. - Add
list-hooks.sh
to the tasks folder. - Open
list-hooks.sh
and modify the config parameters.- Change
hookPrefix
to the prefix you use for your actions and filters. - Change
output
to modify where thehooks.txt
file is created. Leave it as it is to generate it in thetasks
folder. - Change
exclude
to ensure certain fodlers are not included in the search for hooks.
- Change
- Navigate to the
tasks
folder in terminal. - Type
bash list-hooks.sh
into terminal and pressenter
. - A file named
hooks.txt
will be generated in yourtasks
folder.
- This script uses
ggrep
which you can install using homebrew. - This script was built for use on a Mac, not sure how well it works on Windows.
Here's a doc for my WooCommerce Delivery Slots plugin which I used this script on.
See anything that could be better? Submit an issue, or even better, a PR!