REST API: Prime caches for featured images in post controller.

Ensure that featured image caches are primed for post collections in the post REST API controller, by calling the `update_post_thumbnail_cache` function. 

Props Spacedmonkey, TimothyBlynJacobs, mitogh.
Fixes #55592. 



git-svn-id: https://develop.svn.wordpress.org/trunk@53499 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonny Harris
2022-06-14 13:08:39 +00:00
parent 219927c11b
commit c2de42b9ad
2 changed files with 39 additions and 0 deletions
@@ -370,6 +370,9 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
$posts = array();
update_post_author_caches( $query_result );
if ( post_type_supports( $this->post_type, 'thumbnail' ) ) {
update_post_thumbnail_cache( $posts_query );
}
foreach ( $query_result as $post ) {
if ( ! $this->check_read_permission( $post ) ) {