{"id":3165,"date":"2012-04-20T20:04:27","date_gmt":"2012-04-20T17:04:27","guid":{"rendered":"http:\/\/mummila.net\/kommentit\/?p=3165"},"modified":"2012-04-20T20:04:27","modified_gmt":"2012-04-20T17:04:27","slug":"youre-probably-hitting-a-wordpress-bug-in-get_search_form","status":"publish","type":"post","link":"https:\/\/mummila.net\/kommentit\/2012\/04\/20\/youre-probably-hitting-a-wordpress-bug-in-get_search_form\/","title":{"rendered":"You&#8217;re probably hitting a WordPress bug in get_search_form()"},"content":{"rendered":"<p>If your theme has a searchform.php, you&#8217;re probably hitting\u00a0<a href=\"http:\/\/core.trac.wordpress.org\/ticket\/16541\">Ticket #16541<\/a>:\u00a0<a href=\"http:\/\/core.trac.wordpress.org\/browser\/tags\/3.3.1\/wp-includes\/general-template.php#L154\">get_search_form() ignores $echo if searchform.php exists<\/a>.<\/p>\n<p>Your workaround is fine if you&#8217;re just echoing the search form anyway, but if you need to capture the output in a variable, you can work around this with\u00a0<a href=\"http:\/\/www.php.net\/manual\/en\/book.outcontrol.php\">output buffering<\/a>:<\/p>\n<pre><code>&lt;?php ob_start();\r\nget_search_form();\r\n$my_search_form = ob_get_clean(); ?&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If your theme has a searchform.php, you&#8217;re probably hitting Ticket #16541: get_search_form() ignores $echo if searchform.php exists.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3922],"tags":[2965],"class_list":["post-3165","post","type-post","status-publish","format-standard","hentry","category-aiheeton","tag-wordpress","sijainti-stack-overflow"],"_links":{"self":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/3165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/comments?post=3165"}],"version-history":[{"count":3,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/3165\/revisions"}],"predecessor-version":[{"id":3168,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/3165\/revisions\/3168"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/media?parent=3165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/categories?post=3165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/tags?post=3165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}