Skip to content

Commit 6f42a46

Browse files
committed
Plugins: Clarify documentation for when current_action and current_filter can return false.
If `current_action` or `current_filter` is called outside of an action/filter, then these functions will return false. Props debarghyabanerjee, mukesh27, peterwilsoncc, SirLouen. Fixes #63479. git-svn-id: https://develop.svn.wordpress.org/trunk@60258 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 682cfff commit 6f42a46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/wp-includes/plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function remove_all_filters( $hook_name, $priority = false ) {
359359
*
360360
* @global string[] $wp_current_filter Stores the list of current filters with the current one last
361361
*
362-
* @return string Hook name of the current filter.
362+
* @return string|false Hook name of the current filter, false if no filter is running.
363363
*/
364364
function current_filter() {
365365
global $wp_current_filter;
@@ -632,7 +632,7 @@ function remove_all_actions( $hook_name, $priority = false ) {
632632
*
633633
* @since 3.9.0
634634
*
635-
* @return string Hook name of the current action.
635+
* @return string|false Hook name of the current action, false if no action is running.
636636
*/
637637
function current_action() {
638638
return current_filter();

0 commit comments

Comments
 (0)