Skip to content

Commit

Permalink
Fix attempt to read post ID on update_post_thumbnail_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
itzmekhokan committed May 26, 2024
1 parent aea04bd commit 0b8fdf7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/wp-includes/post-thumbnail-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ function update_post_thumbnail_cache( $wp_query = null ) {
$thumb_ids = array();

foreach ( $wp_query->posts as $post ) {

/*
* Check $post is valid post object of WP_Post or not,
* while some cases it can be an array of $posts IDs.
*

Check failure on line 120 in src/wp-includes/post-thumbnail-template.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Whitespace found at end of line
* See https://core.trac.wordpress.org/ticket/59521.
*/
if ( ! ( $post instanceof WP_Post ) ) {
$post = get_post( $post );
}

$id = get_post_thumbnail_id( $post->ID );
if ( $id ) {
$thumb_ids[] = $id;
Expand Down

0 comments on commit 0b8fdf7

Please sign in to comment.