[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 13:18:40 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                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+------------------------------

Comment (by birgire):

 That sounds like a useful feature.

 For comparison, the way it's done in {{{WP_User_Query}}} is via the
 {{{user_search_columns}}} filter:

 https://core.trac.wordpress.org/browser/tags/4.9.5/src/wp-includes/class-
 wp-user-query.php#L532

 where the default search fields are (marked with x):

 {{{
 x ID
 x user_login
   user_pass
 x user_nicename
 x user_email
 x user_url
   user_registered
   user_activation_key
   user_status
 x display_name

 }}}

 Similar the {{{WP_User_Query}}} uses the {{{site_search_columns}}} filter,
 with ''domain'' and ''path'' as  default search columns.

 https://core.trac.wordpress.org/browser/tags/4.9.5/src/wp-includes/class-
 wp-site-query.php#L502

 So another approach in the same direction as above, could be with a
 {{{post_search_columns}}} filter.

 I wonder now if one should support both, i.e. a ''search fields input
 argument'' and a ''search fields filter''?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43867#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list