[wp-trac] [WordPress Trac] #59521: Issue with update_post_thumbnail_cache if using get_posts
WordPress Trac
noreply at wordpress.org
Tue Jun 25 12:44:14 UTC 2024
#59521: Issue with update_post_thumbnail_cache if using get_posts
-------------------------------------------------+-------------------------
Reporter: Xendo | Owner: antpb
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 6.7
Component: Media | Version: 6.3.1
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs- | Focuses:
testing |
-------------------------------------------------+-------------------------
Changes (by oglekler):
* milestone: 6.6 => 6.7
Comment:
It looks like straight forward solution but from my point of view there is
still something strange in the functions code itself.
get_the_post_thumbnail() function calls update_post_thumbnail_cache() like
this:
{{{
if ( in_the_loop() ) {
update_post_thumbnail_cache();
}
}}}
and get_posts() should not set the loop 🤔 and if are getting posts in the
loop that has nothing to do with the current post something needs to be
done.
Btw, requesting posts one by one that were originally requested only with
IDs is incorrect from the beginning because it's raising the amount of
requests to the db. Query Monitor is simple tool to check if such things
are happening in the code ‎😅 This worth checking from time to time.
We have RC1 today, so, I am moving this ticket to the next milestone for
further work.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59521#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list