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

Craig Jamieson
Craig Jamieson
19,585 Points

Write an empty function named custom_filter(). Then add your function to the "the_content" filter

I have written the answer as

<?php
function custom_filter( ) {
    add_filter(‘the_content’,'custom_filter’);    
}
?>

<?php
function custom_filter( ) { }
add_filter(‘the_content’,'custom_filter’); 
?>

Both are wrong. Please advise?

3 Answers

Craig Jamieson
Craig Jamieson
19,585 Points

Not even sure how that happened, but retyped and that worked

<?php
function custom_filter( ) { }
add_filter('the_content','custom_filter'); 
?>

Hi Craig,

The second answer is more correct than the first (the first is not an empty function). In the second, check your quotes. They appear to be mismatched.

quotes were wrong for first attempt.