Wordpress, add_filter, get_search_form Wordpress, add_filter, get_search_form wordpress wordpress

Wordpress, add_filter, get_search_form


This is a result of a well known WordPress bug in the get_search_form( $echo ) function will ignore the $echo argument and always echo jf you have a searchform.php template file in your theme.

It's a crap function, with a 2 year old trac ticket. Until they fix it, there are few workarounds:1. Use file_get_contents() - but won't parse the PHP2. Use custom function with the get_searchform hook (not the actual function)3. Or use simple output buffering to capture the output as a variable;

This page has examples for all 3 methods