diff --git a/features/profile-hook-feature.feature b/features/profile-hook-feature.feature new file mode 100644 index 0000000..56e5863 --- /dev/null +++ b/features/profile-hook-feature.feature @@ -0,0 +1,10 @@ +Feature: Profile a specific hook + + Scenario: Profile a hook without any callbacks + Given a WP install + + When I run `wp profile --hook=setup_theme --fields=callback` + Then STDOUT should be a table containing rows: + | callback | + | total | + And STDERR should be empty diff --git a/inc/class-command.php b/inc/class-command.php index 1cf6d27..6afdc6f 100644 --- a/inc/class-command.php +++ b/inc/class-command.php @@ -164,6 +164,10 @@ class Command { else ++$wp_actions[$tag]; + if ( empty( $wp_filter[ $tag ] ) ) { + return; + } + if ( !isset($wp_filter['all']) ) $wp_current_filter[] = $tag;