$ptypes = array
();
// Just use the post_types in the supplied posts.
foreach ( $posts as $post ) { $ptypes[] =
$post->post_type;
} $ptypes =
array_unique( $ptypes );
} else { $ptypes = array
( $post_type );
} if ( !
empty( $ptypes ) ) { update_object_term_cache( $post_ids,
$ptypes );
} } if ( $update_meta_cache ) { update_postmeta_cache( $post_ids );
}}/**
* Updates post author user caches for a list of post objects.
*
* @since 6.1.0
*
* @param WP_Post[] $posts Array of post objects.
*/