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. Built from https://develop.svn.wordpress.org/trunk@53507 git-svn-id: http://core.svn.wordpress.org/trunk@53096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2c8a6170af
commit
84a8194200
|
@ -7490,16 +7490,17 @@ function update_post_author_caches( $posts ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Prime post parent post caches.
|
||||
* Updates parent post caches for a list of post objects.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*
|
||||
* @param WP_Post[] $posts Array of Post objects.
|
||||
* @param WP_Post[] $posts Array of post objects.
|
||||
*/
|
||||
function update_post_parent_caches( $posts ) {
|
||||
$parent_ids = wp_list_pluck( $posts, 'post_parent' );
|
||||
$parent_ids = array_map( 'absint', $parent_ids );
|
||||
$parent_ids = array_unique( array_filter( $parent_ids ) );
|
||||
|
||||
if ( ! empty( $parent_ids ) ) {
|
||||
_prime_post_caches( $parent_ids, false );
|
||||
}
|
||||
|
|
|
@ -369,8 +369,9 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||
|
||||
$posts = array();
|
||||
|
||||
update_post_parent_caches( $query_result );
|
||||
update_post_author_caches( $query_result );
|
||||
update_post_parent_caches( $query_result );
|
||||
|
||||
if ( post_type_supports( $this->post_type, 'thumbnail' ) ) {
|
||||
update_post_thumbnail_cache( $posts_query );
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-alpha-53506';
|
||||
$wp_version = '6.1-alpha-53507';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue