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 trial

WordPress WordPress Hooks - Actions and Filters Filter Functions in WordPress WordPress Filter Helper Functions

Sam Gord
Sam Gord
14,084 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,084 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