Support » Themes and Templates » 3.6 upgrade – searchform.php not working

  • Resolved Tracy Levesque


    🏳️‍🌈 YIKES, Inc. Co-Owner

    Hi Guys.

    I just updated one of my sites to WordPress 3.6 and it is no longer using the searchform.php file in my theme.

    Where I have the template tag <?php get_search_form(); ?>
    it is now inserting the default search form instead of the theme’s searchform.php

    Did the template tag change or something?


Viewing 13 replies - 1 through 13 (of 13 total)
  • Same problem here. Did some hunting and whilst they’ve made the form HTML5 friendly, I can’t see any issues with the template tag get_search_form and why it’s not calling searchform.php.

    Can anyone shed any light on this?

    I have the same issue, very strange!

    What theme(s) are these?

    Tracy Levesque


    🏳️‍🌈 YIKES, Inc. Co-Owner

    I am using a custom theme built off _underscores.

    After doing some digging it looks like instead of using a template to override the default search you now need to build a function with a filter? I may be wrong about this, but either way I just need to know how to get my custom search form working again.


    Tracy, the new filter in get_search_form() is ‘search_form_format’. You can return either ‘html5’ or ‘xhtml’. There is an example in the filter reference.

    i have some problem too. But after searching in the codex, now i use filter instead of calling <?php get_search_form(); ?>.

    function my_search_form( $form ) {
        $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
        <div><label class="screen-reader-text" for="s">' . __( 'Search for:' ) . '</label>
        <input type="text" value="' . get_search_query() . '" name="s" id="s" />
        <input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search' ) .'" />
        return $form;
    add_filter( 'get_search_form', 'my_search_form' );


    Forum Moderator

    A custom searchform.php template file works for me in _s.

    Tracy Levesque


    🏳️‍🌈 YIKES, Inc. Co-Owner

    I will try the filter.

    Thanks, everyone!

    instead of adding that whole filter, all i did was include searchform.php

    <?php include(‘searchform.php’); ?>

    All fixed, it was reading the filter in functions.php instead of searchform.php so I changed the filter form to match my custom form and deleted the searchform.php template and it works fine now, thanks!

    Lee’s answer pointing me in the right direction – an old function was taking priority over searchform.php for some reason. Removed the function and all is well again.

    Using <?php include(‘searchform.php’); ?> as mrgreenwaters suggested seems like overkill and probably not the most efficient way of doing things.

    Tracy Levesque


    🏳️‍🌈 YIKES, Inc. Co-Owner

    That was it. Removed search function from functions.php

    I forgot I was using a old version of the Bones starter theme, not _s

    Thanks, everyone.

    Adding this code to your functions.php should do the trick.

    function search_form_no_filters() {
      // look for local searchform template
      $search_form_template = locate_template( 'searchform.php' );
      if ( '' !== $search_form_template ) {
        // searchform.php exists, remove all filters
    add_action('pre_get_search_form', 'search_form_no_filters');

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘3.6 upgrade – searchform.php not working’ is closed to new replies.