[wp-trac] [WordPress Trac] #49553: Add option to get_search_form() to not include current search query in the form
WordPress Trac
noreply at wordpress.org
Fri Jul 4 14:15:38 UTC 2025
#49553: Add option to get_search_form() to not include current search query in the
form
------------------------------------------+------------------------------
Reporter: joelhardi | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 5.4
Severity: normal | Resolution:
Keywords: has-patch dev-feedback close | Focuses: template
------------------------------------------+------------------------------
Changes (by callumbw95):
* keywords: has-patch dev-feedback => has-patch dev-feedback close
Comment:
Hi @joelhardi,
Thank you for submitting this ticket, sorry no one has got back to you
until now! The request to have `get_search_form()` output a search field
without the current query pre-filled is a valid use case for specific
design requirements.
However, WordPress provides the `get_search_form` filter, which allows
developers to completely customize the HTML output of the search form. By
hooking into this filter, it's possible to modify the form's HTML to
remove the `value` attribute from the search input field (e.g., `<input
type="search" name="s" value="..." />`).
Since the desired functionality can already be achieved effectively
through existing extensibility points in WordPress, we believe adding a
dedicated parameter to `get_search_form()` for this specific purpose is
not necessary and would add API complexity where a more general solution
via filters is already available.
For these reasons, I suggest that we eventually close this ticket as
`wontfix` as developers are encouraged to use the `get_search_form` filter
for such customizations.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49553#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list