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 How to Build a WordPress Plugin How WordPress Plugins Work Filters Code Challenge

add_filter

add_filter how to use

plugin.php
<?php

function custom_filter() {
  add_filter();




}



?>

1 Answer

Kevin Hamil
Kevin Hamil
8,203 Points

I believe you would move add_filter() outside of your customer_filter() function... and you would need to specify what existing function you would like to filter. If I'm wrong, someone correct me, or even elaborate if it needs to be made more clear.

<?php

function custom_filter() {
// your filter code
}
add_filter( 'name_of_function_you_want_to_filter', 'custom_filter');

?>