I wanted to override the wordpress default search with my custom search, however when i put the following code in the plugin file it doesn't appear replace the default searchbox(no error, nothing) and when i put the code in functions.php it works fine and replaces the default searchbox.
Can anyone tell me why is it not working in plugin file? Thanks!
function DynamiteSearch($form) {
$form = '<form method="get" id="searchform" action="' . get_option('home') . '/" >
<div><label class="hidden" for="s">' . __('Search for:') . '</label>
<input type="text" value="' . attribute_escape(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="'.attribute_escape(__('Search')).'" />
</div>
</form>';
return $form;
}
add_filter('get_search_form', 'DynamiteSearch');