WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#39972 new feature request

REST API: Allow querying posts by post format

Reported by: sba7elfol Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords:
Focuses: rest-api Cc:

Description

Although it is listed in the REST API reference,

posts?format=video

shows all posts.

Change History (3)

#1 @rmccue
2 years ago

Which reference are you referring to? The reference on developer.wordpress.org doesn't appear to list this as a valid query parameter. While you can set it on a post, this is not the same as the collection query parameters.

#2 @jnylen0
2 years ago

  • Summary changed from REST API Post format=video to REST API: Allow querying posts by post format
  • Type changed from defect (bug) to feature request
  • Version changed from 4.7.2 to 4.7

Filtering by post format could be a nice enhancement, but as Ryan noted, this parameter is currently only supported for reading and editing individual posts. @sba7elfol can you give us some more information about your use case?

The WP_Query docs have an example of querying the post_format taxonomy - third example in the Taxonomy Parameters section.

Currently it would be possible to insert these extra query parameters in a plugin or theme using the 'rest_post_query' filter.

#3 @joehoyle
2 years ago

+1 on adding support for format as a collection args, and building the tax query for it.

Note: See TracTickets for help on using tickets.