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');

Signature

apply_filters( $tag, $value )
tag
 (string) The name of the filter hook.
value
 (mixed) The value on which the filters hooked to <tt>$tag</tt> are applied on.

Return

(mixed) The filtered value after all hooked functions are applied to it.

Source

function apply_filters($tag, $value) {
	global $wp_filter, $merged_filters, $wp_current_filter;

	$args = array();

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

	if ( !isset($wp_filter[$tag]) ) {
		if ( isset($wp_filter['all']) )
			array_pop($wp_current_filter);
		return $value;
	}

	if ( !isset($wp_filter['all']) )
		$wp_current_filter[] = $tag;
25 more lines...
WP Trac GitHub Bitbucket

Link here