[wp-trac] [WordPress Trac] #61008: Allow searching of extra post fields
WordPress Trac
noreply at wordpress.org
Mon Apr 15 07:24:36 UTC 2024
#61008: Allow searching of extra post fields
-------------------------+-----------------------------
Reporter: dd32 | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
#43867 / [55248] introduced the 'post_search_columns' filter and
'search_columns' parameter to select which fields are searched by
WP_Query, but this is limited to the 3 fields it searches by default,
`post_title, post_excerpt, post_content`.
If one wants to search an additional field, such as `post_name`, you are
required to use the SQL filters instead.
It would be helpful for WP_Query to be expanded to cover additional
fields, where viable.
Additionally; as it currently searches a post meta field, it might be
possible to additionally add that.
See https://meta.trac.wordpress.org/changeset/13522 for an example of a
SQL filter for this.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61008>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list