Make WordPress Core


Ignore:
Timestamp:
12/01/2021 01:20:36 PM (5 years ago)
Author:
johnbillion
Message:

Plugins: Correct the documented allowable types for to the $callback parameter of various hook related functions.

These functions don't require the callback to be a valid callable, therefore array and string are also valid types for this parameter.

Props malthert

Fixes #54440

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-hook.php

    r51530 r52300  
    169169         * @since 4.7.0
    170170         *
    171          * @param string   $hook_name The filter hook to which the function to be removed is hooked.
    172          * @param callable $callback  The callback to be removed from running when the filter is applied.
    173          * @param int      $priority  The exact priority used when adding the original filter callback.
     171         * @param string                $hook_name The filter hook to which the function to be removed is hooked.
     172         * @param callable|string|array $callback  The callback to be removed from running when the filter is applied.
     173         *                                         This method can be called unconditionally to speculatively remove
     174         *                                         a callback that may or may not exist.
     175         * @param int                   $priority  The exact priority used when adding the original filter callback.
    174176         * @return bool Whether the callback existed before it was removed.
    175177         */
     
    202204         * @since 4.7.0
    203205         *
    204          * @param string         $hook_name Optional. The name of the filter hook. Default empty.
    205          * @param callable|false $callback  Optional. The callback to check for. Default false.
     206         * @param string                      $hook_name Optional. The name of the filter hook. Default empty.
     207         * @param callable|string|array|false $callback  Optional. The callback to check for.
     208         *                                               This method can be called unconditionally to speculatively check
     209         *                                               a callback that may or may not exist. Default false.
    206210         * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has
    207211         *                  anything registered. When checking a specific function, the priority
Note: See TracChangeset for help on using the changeset viewer.