WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/28/2018 12:22:48 PM (3 years ago)
Author:
flixos90
Message:

REST API: Support pagination, order, search and other common query parameters for revisions.

The original REST API revisions controller relied on wp_get_post_revisions(), getting all revisions of a post without any possibility to restrict the result. This changeset replaces that function call with a proper WP_Query setup, replicating how wp_get_post_revisions() works while offering parameters to alter the default behavior.

Props adamsilverstein, birgire, flixos90.
Fixes #40510.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r43571 r43584  
    877877             * @param string $value The query_var value.
    878878             */
    879             $query_args[ $key ] = apply_filters( "rest_query_var-{$key}", $value );
     879            $query_args[ $key ] = apply_filters( "rest_query_var-{$key}", $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    880880        }
    881881
Note: See TracChangeset for help on using the changeset viewer.