[wp-hackers] apply_filters() in an if statement?

Micky Hulse mickyhulse.lists at gmail.com
Wed Feb 29 20:38:41 UTC 2012


Hello,

Sorry in advance if this type of question belongs on the forums...

I am hacking a theme, and they have something like this (abbreviated):

[code]

if (option('foo') || apply_filters('baz_baz', '') ||
apply_filters('bar_bar', '')) {

   $bar_bar = apply_filters('bar_bar', blah, blah);
   $return = apply_filters('baz_baz', blah, blah);

}

[/code]

What does apply_filters('string', '') accomplish? I guess I am
confused because the second argument is an empty string.

This helps to explain (at least in my brain) what apply_filters() does:

"In the most basic terms, apply_filters is used to initialise a filter
hook... add_filter assigns a new function to hooks that have already
been created."
--<http://stackoverflow.com/questions/2270989/what-does-apply-filters-actually-do-in-wordpress>

But why would you put it in an if statement with an empty string for
the second argument?

Am I talking crazy here?

Let me know if this type of question is too noob for this list. I
don't want to bug folks with simple ones. :D

Thanks a billion!

Cheers,
Micky


More information about the wp-hackers mailing list