[wp-trac] [WordPress Trac] #33988: New param for search in WP Query
WordPress Trac
noreply at wordpress.org
Wed Sep 30 00:08:30 UTC 2015
#33988: New param for search in WP Query
------------------------------+-----------------------------
Reporter: sebastian.pisula | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Query | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
------------------------------+-----------------------------
Comment (by DrewAPicture):
Replying to [comment:1 boonebgorges]:
> > I think that good idea is, if param "s" will be have support for
array.
>
> Use `search_terms`. `get_posts( array( 'search_terms' => array( 'tiger',
'lion', 'dog' ) ) )`
>
> I like the idea of `NOT LIKE` searches, but I wonder if we can come up
with a more elegant syntax than 'without_s'. For example, we have
'search_terms'; maybe we could add something like
`'search_terms__not_in'`. Or maybe we could add boolean operators to the
search, so that `'search_terms' => array( '-tiger', 'lion' )` will match
posts *with* 'lion' but *without* 'tiger'. See
https://support.google.com/websearch/answer/2466433?hl=en for a list of
what Google supports.
What about `search_terms_exclude` as an argument name? I also like the
boolean operator approach, especially since it's already in use other
places in core. The latter seems like a more-elegant approach.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33988#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list