Make WordPress Core


Ignore:
Timestamp:
11/29/2019 09:40:58 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Docs: Correct @param type for the function parameter in tests_add_filter() and _test_filter_build_unique_id().

Synchronize documentation for add_filter(), tests_add_filter(), _wp_filter_build_unique_id(), _test_filter_build_unique_id().

Add a note that $tag and $priority are no longer used in _wp_filter_build_unique_id() since [46220], and the function always returns a string now.

Props donmhico, remcotolsma, SergeyBiryukov.
Fixes #47407. See #48303.

File:
1 edited

Legend:

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

    r46586 r46801  
    6565     * @param string   $tag             The name of the filter to hook the $function_to_add callback to.
    6666     * @param callable $function_to_add The callback to be run when the filter is applied.
    67      * @param int      $priority        The order in which the functions associated with a
    68      *                                  particular action are executed. Lower numbers correspond with
    69      *                                  earlier execution, and functions with the same priority are executed
    70      *                                  in the order in which they were added to the action.
     67     * @param int      $priority        The order in which the functions associated with a particular action
     68     *                                  are executed. Lower numbers correspond with earlier execution,
     69     *                                  and functions with the same priority are executed in the order
     70     *                                  in which they were added to the action.
    7171     * @param int      $accepted_args   The number of arguments the function accepts.
    7272     */
    7373    public function add_filter( $tag, $function_to_add, $priority, $accepted_args ) {
    74         $idx              = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
     74        $idx = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
     75
    7576        $priority_existed = isset( $this->callbacks[ $priority ] );
    7677
     
    163164     * @since 4.7.0
    164165     *
    165      * @param string   $tag                The filter hook to which the function to be removed is hooked. Used
    166      *                                     for building the callback ID when SPL is not available.
     166     * @param string   $tag                The filter hook to which the function to be removed is hooked.
    167167     * @param callable $function_to_remove The callback to be removed from running when the filter is applied.
    168168     * @param int      $priority           The exact priority used when adding the original filter callback.
     
    190190     * @since 4.7.0
    191191     *
    192      * @param string        $tag               Optional. The name of the filter hook. Used for building
    193      *                                         the callback ID when SPL is not available. Default empty.
     192     * @param string        $tag               Optional. The name of the filter hook. Default empty.
    194193     * @param callable|bool $function_to_check Optional. The callback to check for. Default false.
    195194     * @return bool|int The priority of that hook is returned, or false if the function is not attached.
Note: See TracChangeset for help on using the changeset viewer.