WordPress replace search form html

0.91K views
no comments
19 Nov 2014 1:01 am

By default #wordpress get_search_form function return default html of search form, you want to change or modify search form html here is example to replace whole search form.

In below code we used #wordpress hook to modify search form html.

function sd_search_form($form){
    $form = '<form class="search_form" role="search" method="get" id="searchform" action="' . home_url('/') . '" >
    <input autocomplete="off" type="text" class="search_textField get_searchval" placeholder="Type text about post..." value="' . get_search_query() . '" name="s" id="s" />
    <input type="submit" id="searchsubmit" value="" class="search_textSubmit" />
    </form>';
    return $form;
}

add_filter('get_search_form', 'sd_search_form');

NOTE:Your Email Address will be not shown and please do not add spamming comments because here is REL="NOFOLLOW" on your links and comments also moderated shown.
<code>Put html css or any language code under this tag</code>