Make WordPress Core


Ignore:
Timestamp:
07/22/2022 01:22:04 PM (22 months ago)
Author:
spacedmonkey
Message:

REST API: Use wp_get_lastest_revision_id_and_total_count function in WP_REST_Posts_Controller class.

Add new function called wp_get_lastest_revision_id_and_total_count, that performs an optimized query to get the last revision and total and use it in WP_REST_Posts_Controller class.

Props Spacedmonkey, timothyblynjacobs, furi3r, peterwilsoncc.
Fixes #55857.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r53512 r53759  
    122122
    123123    public function save_posts_clauses( $orderby, $query ) {
    124         array_push( $this->posts_clauses, $orderby );
     124        if ( 'revision' !== $query->query_vars['post_type'] ) {
     125            array_push( $this->posts_clauses, $orderby );
     126        }
    125127        return $orderby;
    126128    }
Note: See TracChangeset for help on using the changeset viewer.