This page redirects to an external site: https://developer.wordpress.org/reference/functions/apply_filters/
Languages: English • Italiano • 日本語 (Add your language)
Call the functions added to a filter hook. See the Plugin API for a list of filter hooks.
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.
<code style="color: #000000"> <span style="color: #0000BB"><?php apply_filters</span><span style="color: #007700">( </span><span style="color: #0000BB">$tag</span><span style="color: #007700">, </span><span style="color: #0000BB">$value</span><span style="color: #007700">, </span><span style="color: #0000BB">$var </span><span style="color: #007700">... ); </span><span style="color: #0000BB">?></span> </code>
Note: The type of return should be the same as the type of $value: a string or an array, for example.
echo apply_filters( $tag, $value );
$myvar = apply_filters( $tag, $value );
$myvar = apply_filters( $tag, $value, $param, $otherparam ); For example: $myvar = apply_filters( 'example_filter', 'filter me', 'arg1', 'arg2 ');
$my_custom_title = apply_filters('the_title', ' My Custom Title (tm) ');
$my_custom_title will now contain 'My Custom Title ™', since the_title filter applies wptexturize() and trim(), among others.
apply_filters() is located in wp-includes/plugin.php.