[wp-trac] [WordPress Trac] #44326: Add relation parameter to REST API /wp/v2/posts endpoint
WordPress Trac
noreply at wordpress.org
Thu Jun 7 19:21:13 UTC 2018
#44326: Add relation parameter to REST API /wp/v2/posts endpoint
-------------------------+--------------------------------------
Reporter: earnjam | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 4.7
Severity: normal | Keywords: has-patch has-unit-tests
Focuses: rest-api |
-------------------------+--------------------------------------
The REST API `/wp/v2/posts` endpoint allows filtering by terms across
multiple taxonomies, but it always uses an AND relationship between them.
Basically:
`/wp/v2/posts?tags=1&categories=2`
Translates to:
`All posts with Tag 1 AND Category 2`
`WP_Query` supports passing a `relation` parameter when running a tax
query across multiple taxonomies. It defaults to AND, which is what we do
now, but it would be nice to support the ability to specify OR here as
well.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44326>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list