apply_filters_ref_array( string $hook_name, array $args ): mixed
- Since
- 3.0.0
- Source
wp-includes/plugin.php:228
Calls the callback functions that have been added to a filter hook, specifying arguments in an array.
Parameters
$hook_namestring- The name of the filter hook.
$argsarray- The arguments supplied to the functions hooked to
$hook_name.
Return
mixed- The filtered value after all hooked functions are applied to it.
Uses · 1
- _wp_call_all_hook()Calls the 'all' hook, which will process the functions hooked into it.
Used by · 12
- WP_Comment_Query::get_comment_ids()Used internally to get a list of comment IDs matching the query vars.
- WP_Comment_Query::get_comments()Get a list of comments matching the query vars.
- WP_Meta_Query::get_sql()Generates SQL clauses to be appended to a main query.
- WP_Network_Query::get_network_ids()Used internally to get a list of network IDs matching the query vars.
- WP_Network_Query::get_networks()Gets a list of networks matching the query vars.
- WP_Query::get_posts()Retrieves an array of posts based on query variables.
- WP_Query::set_found_posts()Sets up the amount of found posts and the number of pages (if limit clause was used) for the current query.
- WP_Site_Query::get_site_ids()Used internally to get a list of site IDs matching the query vars.
- WP_Site_Query::get_sites()Retrieves a list of sites matching the query vars.
- WP_Term_Query::get_terms()Retrieves the query results.
- WP_User_Query::query()Executes the query, with the current variables.
- apply_filters_deprecated()Fires functions attached to a deprecated filter hook.
Source
function apply_filters_ref_array( $hook_name, $args ) { global $wp_filter, $wp_filters, $wp_current_filter; if ( ! isset( $wp_filters[ $hook_name ] ) ) { $wp_filters[ $hook_name ] = 1; } else { ++$wp_filters[ $hook_name ]; } // Do 'all' actions first. if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return $args[0]; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } $filtered = $wp_filter[ $hook_name ]->apply_filters( $args[0], $args ); array_pop( $wp_current_filter ); return $filtered;}History
Introduced in 3.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/plugin.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.