mirror of
https://hk.gh-proxy.com/https://github.com/wp-cli/profile-command.git
synced 2025-08-21 06:38:51 +08:00
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:
commit
444951c49d
2 changed files with 14 additions and 0 deletions
10
features/profile-hook-feature.feature
Normal file
10
features/profile-hook-feature.feature
Normal 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
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue