Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress WordPress Hooks - Actions and Filters Filter Functions in WordPress The apply_filters Function

Martin Gibson
Martin Gibson
6,581 Points

Why do filters exist?

After watching this video on filters it got me thinking about the purpose of filters. Like the purpose of a filter is to provide a way for someone to edit something, whether it be in a plugin, theme or Wordpress itself. But why not instead of documenting filters, communicating filters and expecting users to know how to use a filter, why not just create a settings page? This seems far more practical. Am I missing something?

1 Answer

Shane Oliver
Shane Oliver
19,950 Points

A filter is a the middle point between the browser and the server. When you call information from the server or pass to the server you may need to filter this data for various reasons. For example, requesting an API requires filtering before displaying the results in a meaningful way to users.