Plugins: Add a `current_priority()` method to `WP_Hook`.
This allows plugins to determine the currently running priority of a filter. Merges [39430] to the 4.7 branch. Fixes #39007. Built from https://develop.svn.wordpress.org/branches/4.7@39431 git-svn-id: http://core.svn.wordpress.org/branches/4.7@39371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
77022af062
commit
0b152a7f2c
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-RC1-39429';
|
||||
$wp_version = '4.7-RC1-39431';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue