Make WordPress Core

Opened 8 months ago

#61008 new enhancement

Allow searching of extra post fields

Reported by: dd32's profile dd32 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Query Keywords:
Focuses: Cc:

Description

#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.

Change History (0)

Note: See TracTickets for help on using tickets.