Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm going back through my older WordPress theme and making the functions filterable and also adding the function_exists checks. Is there anything I'm not thinking about that this may cause problems with existing code?

// Dummy function
if ( ! function_exists( 'custom_func' )) {
    function custom_func() {
        $output = "Something Awesome";
        return apply_filters('custom_func', $output);
    }
}

Thanks!

share|improve this question
add comment

1 Answer

I would add prefixes, as a plugin developer may have functions with the same name or filters with the same name, e.g. mytheme_

share|improve this answer
    
Agreed. (My example wasn't great) I am just wondering of any downsides of adding the apply_filters to every custom function to make the themes more flexible down the road. –  hhins Nov 17 '11 at 1:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.