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 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.