Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialYohan Park
7,148 PointsWhy tie apply_filters to a value?
when using apply filter we echo out a value that is equal to apply filters. at 1:25
echo $value = apply_filters( …)
why do that instead of
echo apply_filters()
what's the importance?
Ryan Dainton
17,164 PointsRyan Dainton
17,164 PointsHi Yohan
My understanding is that you will not always want to echo out the results of your apply_filters() method, and so it's best to save it as a variable which can then be echo'd when required.
For example, looking at the 'wp_title' Hook, the filter is applied, but the result is only echoed to the screen if $display === true.