Per today's REST API chat, supporting pagination and generally allowing a bit more flexibility with the revisions controller would also come in handy for Gutenberg.
40510.diff adds support for the following query parameters for revisions:
exclude
include
offset
order
(default 'desc')
orderby
(default 'date')
page
(default 1)
per_page
(default not provided, falling back to using -1 with WP_Query
, meaning no limit, for BC with current behavior)
search
The implementation aligns closer with how the posts controller works. WP_Query
is directly used instead of calling wp_get_post_revisions()
, to be able to run a SELECT FOUND_ROWS()
query and get the result. Since the function is only a simple wrapper for a query object anyway which sets default arguments, this can easily be handled in the controller itself.
The revisions controller will now return X-WP-Total
and X-WP-TotalPages
headers and pagination link headers (if applicable) for collection requests, just how the posts controller does.