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 WordPress Filter Helper Functions

Sam Gord
Sam Gord
14,060 Points

i really cant understand current_filter usage! please help, thanks very much in advance .

i did watch the part about current_filter several times and took notes for myself in order to explaining it to myself so i can understand the usage of it but no green lights! i'm stuck . please help . thanks very much .

Sam Gord
Sam Gord
14,060 Points

i think i got this , but correct me if i'm wrong . current_filter tells us what filter is being used/run at certain point and makes us being able to add our custom code to that filter .

2 Answers

Danica Louwe
Danica Louwe
3,423 Points

It's useful for cases when you wanna reuse a filter function for different types of filters instead of creating a new function everytime.

Liam Maclachlan
Liam Maclachlan
22,805 Points

Hi Sam,

Bang on. If you are running that, it will give you that information. More info can be found in the WordPress codex for the function current_filter()

Cheers Liam