mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53507 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user