WordPress 3.6 Search form fix

Oscar, as it has been dubbed, changed the way the get_search_form was filtered. This means the Roots custom search form is broken. Fret not, there’s a fix that will soon be merged into head and another (less elegant) fix detailed in the PR that maintains compatibility with 3.5 should you need it.

Is this correct?

\lib\cleanup.php

remove text (after line 258 comment):

function roots_get_search_form($argument) {
  if ($argument === '') {
    locate_template('/templates/searchform.php', true, false);
  }
}
add_filter('get_search_form', 'roots_get_search_form');

and replace with:

function roots_get_search_form($form) {
  ob_start();
  locate_template('/templates/searchform.php', true, false);
  $form = ob_get_clean();
  return $form;
}
add_filter('get_search_form', 'roots_get_search_form');

That’s the fix for maintaining backwards compatibility. If you only need support for 3.6 then you should use the change from the pull release:

function roots_get_search_form($form) {
  $form = '';
  locate_template('/templates/searchform.php', true, false);
  return $form;
}
add_filter('get_search_form', 'roots_get_search_form');

I almost understand. I must learn more about GitHub to understand everything you type.

source link

Upper right corner I plugged:

<?php get_search_form( $echo ); ?>

into this file:

\templates\header-top-navbar.php
  • When I type “hello” plus click “index” everything works great!
  • When I type “welcome” plus click “newsletter” it breaks.

With your pull release fix, that will be resolved?
Perhaps there is a user-error on my end with permalink structure?

While I await your response, I’m going to update to wordpress 3.6.
After update, I’ll use the change and reply here with a status update.

Thanks for your swift reply,


reference:

display wordpress search form