Select the Count action hooks and filters
check box when you want to discover all the action hooks and filters that are invoked.
When tracing is active then at shutdown
a number of trace records are written summarising the action hooks and filters that have been invoked.
Information traced
wp_actions | shows the contents of global $wp_actions formatted as hook shortcodes |
bw_action_counts | shows the oik-bwtrace global $bw_action_counts formatted as shortcodes |
most used | bw_action_counts array sorted by invocation count descending |
by hook name | bw_action_counts array sorted by hook name ascending |
unique hooks | Count of the number of unique hooks invoked |
total hooks | Count of the total number of action/filter hooks invoked |
bw_action_counts_tree | view of the counts taking into account nested actions and filters |
Hook shortcode parameters
The hook shortcode takes 5 positional parameters:
- Hook name(s)
- Hook type: action or filter
- Number of args passed
- Number of invocations
- Attached hook function count
To find which functions are attached use Trace attached hooks functions.
Example wp_actions
C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\oik-action-counts.php(205:0) bw_trace_create_hook_links(1) 39 2 2019-12-04T17:50:01+00:00 0.311519 0.011168 cf=shutdown 12898 52 3912 6291456/6291456 256M F=601 hook_links <h3>wp_actions</h3> [hook mu_plugin_loaded action 1 3 0] [hook muplugins_loaded action 0 1 1] [hook registered_taxonomy action 3 26 3] [hook registered_post_type action 2 41 3] [hook plugin_loaded action 1 37 0] [hook load_textdomain action 2 20 0] [hook plugins_loaded action 0 1 17] ... [hook shutdown action 0 1 5]
The wp_actions array may include some actions invoked before action counting was initiated.
See Must-Use and Drop-In logic.
Example bw_action_counts
C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\oik-action-counts.php(205:0) bw_trace_create_hook_links(2) 40 2 2019-12-04T17:50:01+00:00 0.314809 0.003290 cf=shutdown 12898 52 3912 6291456/6291456 256M F=601 hook_links <h3>bw_action_counts</h3> [hook pre_determine_locale filter 1 19 0] [hook pre_option_WPLANG filter 3 1 0] [hook alloptions filter 1 790 0] [hook option_WPLANG filter 2 1 0] [hook locale filter 1 41 1] [hook determine_locale filter 1 19 0] [hook gettext filter 3 4834 0] ... [hook shutdown action 0 1 5]
Example most used
The most used list only shows the hooks that are implemented. In this example we don’t see gettext
. The filter is applied many times but there aren’t any attached filter functions.
C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\oik-action-counts.php(205:0) bw_trace_create_hook_links(3) 41 2 2019-12-04T17:50:01+00:00 0.315855 0.001046 cf=shutdown 12898 52 3912 6291456/6291456 256M F=601 hook_links <h3>most used</h3> [hook option_siteurl filter 2 111 1] [hook option_home filter 2 75 1] [hook map_meta_cap filter 4 62 3] [hook user_has_cap filter 4 62 7] [hook query filter 1 51 1] [hook get_user_metadata filter 4 48 1] [hook pre_render_block filter 2 47 1] ... [hook shutdown action 0 1 5]
Example by hook name
C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\oik-action-counts.php(205:0) bw_trace_create_hook_links(4) 42 2 2019-12-04T17:50:01+00:00 0.316775 0.000920 cf=shutdown 12898 52 3912 6291456/6291456 256M F=601 hook_links <h3>by hook name</h3> [hook _get_page_link filter 2 10 0] [hook add_admin_bar_menus action 0 1 0] [hook add_extra_wpseo_meta_fields filter 1 1 0] [hook admin_bar_init action 0 1 0] [hook admin_bar_menu action 1 1 18] [hook admin_url filter 3 66 0] [hook after_setup_theme action 0 1 4] [hook alloptions filter 1 790 0] ... [hook yoast_seo_development_mode filter 1 1 0]
Example count hooks
C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\oik-action-counts.php(162:0) bw_trace_count_report(1) 43 2 2019-12-04T17:50:01+00:00 0.317042 0.000267 cf=shutdown 12898 52 3912 6291456/6291456 256M F=601 count hooks 753
Example total hooks
C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\oik-action-counts.php(163:0) bw_trace_count_report(2) 44 2 2019-12-04T17:50:01+00:00 0.317178 0.000136 cf=shutdown 12898 52 3912 6291456/6291456 256M F=601 total hooks 12895
Example bw_action_counts_tree
C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\oik-action-counts.php(205:0) bw_trace_create_hook_links(5) 45 2 2019-12-04T17:50:01+00:00 0.318589 0.001411 cf=shutdown 12898 52 3912 6291456/6291456 256M F=601 hook_links <h3>bw_action_counts_tree</h3> [hook pre_determine_locale filter 1 5 0] [hook pre_option_WPLANG filter 3 1 0] [hook alloptions filter 1 248 0] ... [hook plugins_loaded action 0 1 17] [hook plugins_loaded;load_default_widgets filter 1 1 0] ... [hook wp_footer;wp_after_admin_bar_render action 0 1 0] [hook shutdown action 0 1 5]