Docs: Improve the docs for the globals that are used in the actions and filters API.

See #50531, #50768

Built from https://develop.svn.wordpress.org/trunk@49196


git-svn-id: http://core.svn.wordpress.org/trunk@48958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2020-10-18 19:19:06 +00:00
parent afbfe981fc
commit b2515abd45
3 changed files with 28 additions and 21 deletions

View File

@ -261,7 +261,7 @@ class WP_Importer {
* @since 3.0.0
*
* @global wpdb $wpdb WordPress database abstraction object.
* @global array $wp_actions
* @global int[] $wp_actions
*/
public function stop_the_insanity() {
global $wpdb, $wp_actions;

View File

@ -25,7 +25,13 @@
require __DIR__ . '/class-wp-hook.php';
/** @var WP_Hook[] $wp_filter */
global $wp_filter, $wp_actions, $wp_current_filter;
global $wp_filter;
/** @var int[] $wp_actions */
global $wp_actions;
/** @var string[] $wp_current_filter */
global $wp_current_filter;
if ( $wp_filter ) {
$wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
@ -93,7 +99,7 @@ if ( ! isset( $wp_current_filter ) ) {
*
* @since 0.71
*
* @global array $wp_filter A multidimensional array of all hooks and the callbacks hooked to them.
* @global WP_Hook[] $wp_filter A multidimensional array of all hooks and the callbacks hooked to them.
*
* @param string $tag The name of the filter to hook the $function_to_add callback to.
* @param callable $function_to_add The callback to be run when the filter is applied.
@ -119,7 +125,7 @@ function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1
*
* @since 2.5.0
*
* @global array $wp_filter Stores all of the filters and actions.
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
*
* @param string $tag The name of the filter hook.
* @param callable|bool $function_to_check Optional. The callback to check for. Default false.
@ -170,8 +176,8 @@ function has_filter( $tag, $function_to_check = false ) {
*
* @since 0.71
*
* @global array $wp_filter Stores all of the filters and actions.
* @global array $wp_current_filter Stores the list of current filters with the current one last.
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
* @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $tag The name of the filter hook.
* @param mixed $value The value to filter.
@ -218,8 +224,8 @@ function apply_filters( $tag, $value ) {
* @see apply_filters() This function is identical, but the arguments passed to the
* functions hooked to `$tag` are supplied using an array.
*
* @global array $wp_filter Stores all of the filters and actions.
* @global array $wp_current_filter Stores the list of current filters with the current one last.
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
* @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $tag The name of the filter hook.
* @param array $args The arguments supplied to the functions hooked to $tag.
@ -266,7 +272,7 @@ function apply_filters_ref_array( $tag, $args ) {
*
* @since 1.2.0
*
* @global array $wp_filter Stores all of the filters and actions.
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
*
* @param string $tag The filter hook to which the function to be removed is hooked.
* @param callable $function_to_remove The name of the function which should be removed.
@ -292,7 +298,7 @@ function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
*
* @since 2.7.0
*
* @global array $wp_filter Stores all of the filters and actions.
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
*
* @param string $tag The filter to remove hooks from.
* @param int|bool $priority Optional. The priority number to remove. Default false.
@ -316,7 +322,7 @@ function remove_all_filters( $tag, $priority = false ) {
*
* @since 2.5.0
*
* @global array $wp_current_filter Stores the list of current filters with the current one last
* @global string[] $wp_current_filter Stores the list of current filters with the current one last
*
* @return string Hook name of the current filter or action.
*/
@ -351,7 +357,7 @@ function current_action() {
*
* @see current_filter()
* @see did_action()
* @global array $wp_current_filter Current filter.
* @global string[] $wp_current_filter Current filter.
*
* @param null|string $filter Optional. Filter to check. Defaults to null, which
* checks if any filter is currently being run.
@ -433,9 +439,9 @@ function add_action( $tag, $function_to_add, $priority = 10, $accepted_args = 1
* @since 5.3.0 Formalized the existing and already documented `...$arg` parameter
* by adding it to the function signature.
*
* @global array $wp_filter Stores all of the filters and actions.
* @global array $wp_actions Increments the amount of times action was triggered.
* @global array $wp_current_filter Stores the list of current filters with the current one last.
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
* @global int[] $wp_actions Stores the number of times each action was triggered.
* @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $tag The name of the action to be executed.
* @param mixed ...$arg Optional. Additional arguments which are passed on to the
@ -485,7 +491,7 @@ function do_action( $tag, ...$arg ) {
*
* @since 2.1.0
*
* @global array $wp_actions Increments the amount of times action was triggered.
* @global int[] $wp_actions Stores the number of times each action was triggered.
*
* @param string $tag The name of the action hook.
* @return int The number of times action hook $tag is fired.
@ -507,9 +513,10 @@ function did_action( $tag ) {
*
* @see do_action() This function is identical, but the arguments passed to the
* functions hooked to `$tag` are supplied using an array.
* @global array $wp_filter Stores all of the filters and actions.
* @global array $wp_actions Increments the amount of times action was triggered.
* @global array $wp_current_filter Stores the list of current filters with the current one last.
*
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
* @global int[] $wp_actions Stores the number of times each action was triggered.
* @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $tag The name of the action to be executed.
* @param array $args The arguments supplied to the functions hooked to `$tag`.
@ -865,7 +872,7 @@ function register_uninstall_hook( $file, $callback ) {
* @since 2.5.0
* @access private
*
* @global array $wp_filter Stores all of the filters and actions.
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
*
* @param array $args The collected parameters from the hook that was called.
*/

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-alpha-49195';
$wp_version = '5.6-alpha-49196';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.