[wp-trac] [WordPress Trac] #39965: REST API: not possible to request collection of posts across post types

WordPress Trac noreply at wordpress.org
Wed Jul 26 14:56:17 UTC 2017


#39965: REST API: not possible to request collection of posts across post types
-------------------------+-----------------------
 Reporter:  iseulde      |       Owner:  jnylen0
     Type:  enhancement  |      Status:  assigned
 Priority:  normal       |   Milestone:  4.9
Component:  REST API     |     Version:  4.7
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+-----------------------

Comment (by jnylen0):

 Replying to [comment:5 danielbachhuber]:
 > For the record, this violates the principles of REST and I generally
 think it's a really bad idea.

 While it's true that `/wp/v2/posts` currently means "posts with
 `post_type` of `post`", at least a post of another type is still a post.

 > Creating some batch `GET` endpoint would be another approach:
 https://github.com/WP-API/WP-API/issues/1506 GraphQL would be the
 inevitable conclusion.

 This is a far larger task, and our WP.com batch endpoint has caused us a
 lot of very strange issues over the years.  Some of them are specific to
 the setup there; some would eventually reoccur in multisite context with
 site and theme switching.  I think it would ultimately be a pretty bad
 idea to ship this in core.

 How about a separate endpoint like `/wp/v2/posts/all_types`?

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


More information about the wp-trac mailing list