Merge pull request #69 from runcommand/67-fix-empty-hook

Bail early when there aren't any hook callbacks to run
This commit is contained in:
Daniel Bachhuber 2016-09-08 05:53:16 -07:00 committed by GitHub
commit 444951c49d
2 changed files with 14 additions and 0 deletions

View file

@ -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

View file

@ -164,6 +164,10 @@ class Command {
else else
++$wp_actions[$tag]; ++$wp_actions[$tag];
if ( empty( $wp_filter[ $tag ] ) ) {
return;
}
if ( !isset($wp_filter['all']) ) if ( !isset($wp_filter['all']) )
$wp_current_filter[] = $tag; $wp_current_filter[] = $tag;