Make WordPress Core

Changeset 53507


Ignore:
Timestamp:
06/15/2022 01:17:59 PM (4 years ago)
Author:
SergeyBiryukov
Message:

REST API: Some documentation and test improvements for update_post_parent_caches():

  • Make the function description more specific, for consistency with update_post_author_caches().
  • Add missing @covers tags for the unit test.

Follow-up to [53506].

See #55593.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r53506 r53507  
    74917491
    74927492/**
    7493  * Prime post parent post caches.
     7493 * Updates parent post caches for a list of post objects.
    74947494 *
    74957495 * @since 6.1.0
    74967496 *
    7497  * @param WP_Post[] $posts Array of Post objects.
     7497 * @param WP_Post[] $posts Array of post objects.
    74987498 */
    74997499function update_post_parent_caches( $posts ) {
     
    75017501        $parent_ids = array_map( 'absint', $parent_ids );
    75027502        $parent_ids = array_unique( array_filter( $parent_ids ) );
     7503
    75037504        if ( ! empty( $parent_ids ) ) {
    75047505                _prime_post_caches( $parent_ids, false );
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r53506 r53507  
    370370                $posts = array();
    371371
     372                update_post_author_caches( $query_result );
    372373                update_post_parent_caches( $query_result );
    373                 update_post_author_caches( $query_result );
     374
    374375                if ( post_type_supports( $this->post_type, 'thumbnail' ) ) {
    375376                        update_post_thumbnail_cache( $posts_query );
  • trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r53506 r53507  
    15171517        /**
    15181518         * @ticket 55592
    1519          * @covers WP_REST_Posts_Controller::get_items()
     1519         * @covers WP_REST_Posts_Controller::get_items
    15201520         */
    15211521        public function test_get_items_with_featured_media() {
     
    17901790        /**
    17911791         * @ticket 55593
     1792         * @covers WP_REST_Posts_Controller::get_items
     1793         * @covers update_post_parent_caches
    17921794         */
    17931795        public function test_get_items_parent_ids_primed() {
Note: See TracChangeset for help on using the changeset viewer.