apply_filters ( $tag, $value )

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


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.

// Our filter callback function
function example_callback( $string, $arg1, $arg2 ) {
    // (maybe) modify $string
    return $string;
add_filter( 'example_filter', 'example_callback', 10, 3 );

 * Apply the filters by calling the 'example_callback' function we
 * "hooked" to 'example_filter' using the add_filter() function above.
 * - 'example_filter' is the filter hook $tag
 * - 'filter me' is the value being filtered
 * - $arg1 and $arg2 are the additional arguments passed to the callback.
$value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 );

Related Functions

apply_filters_ref_array, apply_filters_deprecated, has_filter, add_filter, wp_list_filter

Top Google Results

User discussions

wpseek mobile