Make WordPress Core


Ignore:
Timestamp:
06/10/2022 03:15:07 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Query: Some documentation and test improvements for update_post_author_caches():

  • Make the descriptions for update_post_author_caches() and update_post_caches() more specific.
  • Move the unit test into its own file, for consistency with update_post_cache() tests. This also allows for using shared fixtures in case more tests are added in the future.

Follow-up to [53482].

See #55716.

File:
1 edited

Legend:

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

    r53482 r53483  
    74257425
    74267426/**
    7427  * Calls major cache updating functions for list of Post objects.
     7427 * Updates post, term, and metadata caches for a list of post objects.
    74287428 *
    74297429 * @since 1.5.0
    74307430 *
    7431  * @param WP_Post[] $posts             Array of Post objects
     7431 * @param WP_Post[] $posts             Array of post objects (passed by reference).
    74327432 * @param string    $post_type         Optional. Post type. Default 'post'.
    74337433 * @param bool      $update_term_cache Optional. Whether to update the term cache. Default true.
     
    74767476
    74777477/**
    7478  * Prime post author user caches.
     7478 * Updates post author user caches for a list of post objects.
    74797479 *
    74807480 * @since 6.1.0
    74817481 *
    7482  * @param WP_Post[] $posts Array of Post objects
     7482 * @param WP_Post[] $posts Array of post objects.
    74837483 */
    74847484function update_post_author_caches( $posts ) {
     
    74867486    $author_ids = array_map( 'absint', $author_ids );
    74877487    $author_ids = array_unique( array_filter( $author_ids ) );
     7488
    74887489    cache_users( $author_ids );
    74897490}
    74907491
    74917492/**
    7492  * Updates metadata cache for list of post IDs.
     7493 * Updates metadata cache for a list of post IDs.
    74937494 *
    74947495 * Performs SQL query to retrieve the metadata for the post IDs and updates the
Note: See TracChangeset for help on using the changeset viewer.