[wp-trac] [WordPress Trac] #43867: Introduce the ability to control which fields are searched in a search query
WordPress Trac
noreply at wordpress.org
Thu Apr 26 12:52:13 UTC 2018
#43867: Introduce the ability to control which fields are searched in a search
query
-----------------------------+------------------------------------------
Reporter: johnbillion | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Keywords: needs-patch needs-unit-tests
Focuses: |
-----------------------------+------------------------------------------
The `s` argument of the `WP_Query::parse_query()` method always searches
the `post_title`, `post_excerpt`, and `post_content` fields, with no way
of controlling this apart from using the `posts_search` filter and
adjusting the SQL manually.
It would be good if it was possible to specify which fields are searched
when performing a query, for example via a `search_fields` argument or
similar.
My use case is for a REST API driven autocomplete field which allows a
user to search post titles without a large number of less relevant results
appearing due to the search spanning post content too.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43867>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list