WordPress at a glance

apply_filters_ref_array() WP 1.0

Execute functions hooked on a specific filter hook, specifying arguments in an array.

  • 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
  • Global. Array. $wp_current_filter Stores the list of current filters with the current one last

No Hooks.


Mixed. The filtered value after all hooked functions are applied to it.


apply_filters_ref_array( $tag, $args );
$tag(string) (required)
The name of the filter hook.
$args(array) (required)
The arguments supplied to the functions hooked to $tag.

Code of apply_filters_ref_array: wp-includes/plugin.php VER 5.0.1

function apply_filters_ref_array($tag, $args) {
	global $wp_filter, $wp_current_filter;

	// Do 'all' actions first
	if ( isset($wp_filter['all']) ) {
		$wp_current_filter[] = $tag;
		$all_args = func_get_args();

	if ( !isset($wp_filter[$tag]) ) {
		if ( isset($wp_filter['all']) )
		return $args[0];

	if ( !isset($wp_filter['all']) )
		$wp_current_filter[] = $tag;

	$filtered = $wp_filter[ $tag ]->apply_filters( $args[0], $args );

	array_pop( $wp_current_filter );

	return $filtered;

Related Functions

From tag: array list help functions (sorting arrays objects)

More from category: Hooks (actions, filters)

No comments
    Hello, !     Log In . Register