apply_filters

apply_filters ( $tag, $value )

Parameters:
  • (string) $tag The name of the filter hook.
  • (mixed) $value The value on which the filters hooked to <tt>$tag</tt> are applied on.
  • (mixed) $var,... Additional variables passed to the functions hooked to <tt>$tag</tt>.
Returns:
  • (mixed) The filtered value after all hooked functions are applied to it.
Defined at:

Description

Call the functions added to a filter hook.

The callback functions attached to filter hook $tag are invoked by calling this function. This function can be used to create a new filter hook by simply calling this function with the name of the new hook specified using the $tag parameter.

The function allows for additional arguments to be added and passed to hooks.

function example_hook($string, $arg1, $arg2)
{
        //Do stuff
        return $string;
}
$value = apply_filters('example_filter', 'filter me', 'arg1', 'arg2');

Related Functions

apply_filters_ref_array, add_filter, has_filter, wp_filter_kses, wp_list_filter

Top Google Results

User discussions

wpseek mobile