Opened 5 years ago
Last modified 5 years ago
#49553 new enhancement
Add option to get_search_form() to not include current search query in the form
Reported by: | joelhardi | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.4 |
Component: | Themes | Keywords: | has-patch dev-feedback |
Focuses: | template | Cc: |
Description
This is a minor enhancement that adds a new option to the argument array of get_search_form()
. The new option would enable the user/theme developer to easily output a search form either with (this is the current function) or without the current search query prepopulated in the <input>
field of the search form. Right now there is no easy way to include an always-empty search form in a template. For example, the user might prefer to have a regular/empty search box in a sidebar or other secondary location.
In the patch I've added a 'show_query'
option that defaults to true
.
So when the template calls get_search_form(array('show_query' => false))
then the search form is output with an empty <input>
field. (And get_search_query()
is not called.)
There is no change in function when a template calls get_search_form()
and doesn't include this new option, so there's no impact on existing templates.
Thanks for considering this enhancement!
proposed path to add show_query option to get_search_form()