[wp-trac] [WordPress Trac] #44618: Returning all posts by searching for "-something" using the REST API

WordPress Trac noreply at wordpress.org
Fri Jul 20 19:51:46 UTC 2018


#44618: Returning all posts by searching for "-something" using the REST API
--------------------------+------------------------------
 Reporter:  parsaasefi    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  4.9.7
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by earnjam):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 This is expected behavior. The REST API uses `WP_Query` for gathering
 results. If you supply a hyphen before a word, then `WP_Query` uses that
 as an exclude word for result sets. Try it with a common word and you'll
 see that posts containing that word are not returned.

 Regarding passing only a hyphen, searches using single A-Z characters or
 hyphens are treated as invalid and return no results.

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


More information about the wp-trac mailing list