Opened 3 years ago
Closed 2 years ago
#8641 closed defect (bug) (fixed)
Post thumbnail can never be fetched inside BP_Blogs_Blog::get_blog_extras()
Reported by: | boonebgorges | Owned by: | imath |
---|---|---|---|
Milestone: | 11.0.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Blogs | Keywords: | has-patch commit |
Cc: |
Description
In #4570 [6472], some logic was introduced to BP_Blogs_Blog::get_blog_extras()
that fetches post thumbnails for use in the loop. It uses get_post_thumbnail_id()
and has_post_thumbnail()
. However, these are always used in the scope of the root blog, so they always reference the root blog and never the correct blog.
In order to work, they need to be moved inside of a switch_to_blog()
block.
Perhaps additionally, it ought to be possible to disable this fetching. I've never used these images (never knew they were supposed to be there until today!!), and I'd prefer to avoid the queries. Perhaps we can have a filter bp_blogs_fetch_latest_post_thumbnails
or something like that.
Attachments (1)
Change History (6)
#3
@
3 years ago
Thanks for the patch @boonebgorges It looks nice after a first sight, I'll test it asap. I can imagine the code is there for quite a long time, there's not many brackets used into the conditions 😁
+1
Thanks for your suggestions @boonebgorges I agree we need to fetch the right post thumbnails and introduce such a filter to disable the extra query