mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Plugins: Add a current_priority() method to WP_Hook.
This allows plugins to determine the currently running priority of a filter. Fixes #39007. git-svn-id: https://develop.svn.wordpress.org/trunk@39430 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -351,6 +351,22 @@ final class WP_Hook implements Iterator, ArrayAccess {
|
||||
$this->nesting_level--;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current priority level of the currently running iteration of the hook.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access public
|
||||
*
|
||||
* @return int|false If the hook is running, return the current priority level. If it isn't running, return false.
|
||||
*/
|
||||
public function current_priority() {
|
||||
if ( false === current( $this->iterations ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return current( current( $this->iterations ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes filters set up before WordPress has initialized to WP_Hook objects.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user