Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix attempt to read post ID on update_post_thumbnail_cache #6636

Closed
wants to merge 10 commits into from
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 @@
$thumb_ids = array();
peterwilsoncc marked this conversation as resolved.
Show resolved Hide resolved

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*
*

Fix PHPCS

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mukeshpanchal27 fixed and updated test cases.

* See https://core.trac.wordpress.org/ticket/59521.
*/
if ( ! ( $post instanceof WP_Post ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( ! ( $post instanceof WP_Post ) ) {
if ( ! $post instanceof WP_Post ) {

Nit-pick

$post = get_post( $post );
}

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