What is apply_filters(...) in WP please?

+2 votes
asked Jun 2, 2016 in Wordpress by Alfred
I'm doing some self study on frameworks and cons packages. Trying to build a feature rich list to finally build and bundle my own product package. Looking over the function in WordPress, apply_filters(...), can't get my head around what it actually does.

Can someone shed some light to clear this up for me please. A few examples would be helpful if possible.

1 Answer

0 votes
answered Jun 13, 2016 by Merlin Samps
The apply_filters() 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 callback functions attached to filter hook $tag are invoked by calling this function.

$value = apply_filters( $tag, $value, $var_1, $var_2, $var_3, ... );

You can use apply_filters to filter a given $value - with relation to the value itself and optionally provided variables inside the range $var_1 to $var_n.

Please refer here for more official info on this.

Related questions

+2 votes
2 answers 4086 views
0 votes
1 answer 354 views
asked Aug 25, 2016 in Wordpress by Sita
0 votes
1 answer 552 views
0 votes
1 answer 261 views
+1 vote
1 answer 309 views
asked Oct 14, 2016 in Wordpress by Justin
+2 votes
1 answer 567 views