Make WordPress Core


Ignore:
Timestamp:
01/04/2021 04:56:20 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Docs: Synchronize and correct documentation for has_filter() and WP_Hook::has_filter().

WP_Hook::has_filter() returns true if $function_to_check is omitted and the hook being checked has one or more registered callbacks.

Follow-up to [49927].

See #51800.

File:
1 edited

Legend:

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

    r49927 r49928  
    188188     * Checks if a specific action has been registered for this hook.
    189189     *
    190      * When using the $function_to_check argument, this function may return a non-boolean value
    191      * that evaluates to false (e.g. 0), so use the === operator for testing the return value.
     190     * When using the `$function_to_check` argument, this function may return a non-boolean value
     191     * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
    192192     *
    193193     * @since 4.7.0
     
    195195     * @param string         $tag               Optional. The name of the filter hook. Default empty.
    196196     * @param callable|false $function_to_check Optional. The callback to check for. Default false.
    197      * @return false|int The priority of that hook is returned, or false if the function is not attached.
     197     * @return int|bool If `$function_to_check` is omitted, returns boolean for whether the hook has
     198     *                  anything registered. When checking a specific function, the priority of that
     199     *                  hook is returned, or false if the function is not attached.
    198200     */
    199201    public function has_filter( $tag = '', $function_to_check = false ) {
Note: See TracChangeset for help on using the changeset viewer.