Featured image on Speakers CPT not saved
Describe the bug
When we edit a speaker and set the image, all seems ok, but on a new edit or reload, we can see that the image is missing.
To reproduce
Steps to reproduce the behavior:
- Go to Speaker edit
- Click on Set featured image
- Save
- You'll see the image, and all seems okay.
- Reload that page or go to edit on a new tab.
- You'll see that the featured image is missing.
Expected behavior
To see the new featured image saved.
Screenshots / Screencasts
https://video.tabernawp.com/conversations/eefc3ad4-f5ee-53bd-967e-931caeaa7109
WordCamp
I see this error on two different WordCamp websites
System (please complete the following information)
- Device: Desktop
- OS: Windows 11
- Browser Edge
- Version 126.0.2592.87
Thanks a lot.
I checked that the image is saved, and we can show it with the block Speaker/Organizer Avatar, but it's not shown in the speaker backend, and we can't show that image with the featured image block that we'd like to use to show a bigger image of the speaker.
I had the same issue today and went through a few things with @dd32, we may have found a potential cause. Referencing this chat https://wordpress.slack.com/archives/C08M59V3P/p1754607079267989
The issue definitely is hide_featured_image_on_people
https://github.com/WordPress/wordcamp.org/blob/35531083fc18dbd0cf27bfb3557e98fbe4742000/public_html/wp-content/plugins/wc-post-types/wc-post-types.php#L1174-L1205
I added this because the avatar was output twice, and this fixed that. I think it was from the time before wide adoption of block themes, since on classic themes the avatar is prepended to the content, but on Twenty Nineteen, Twenty Seventeen etc, the featured image is also injected in the template and organizers can't remove that. So if an organizer added a speaker's image as featured, it would be in the header and in the content.
Long screenshot
Cat image is there twice, once big (featured) and once small (prepended avatar).
This isn't an issue on block themes because the avatar is not injected on block themes, and users can edited templates to add/remove featured images (or the avatar block).
Anyway, I think the best way to fix this in a way that's safe for older WCs would be to add this condition to hide_featured_image_on_people
if ( site_supports_block_templates() ) {
return $value;
}
however, it probably wouldn't impact much to remove hide_featured_image_on_people entirely, the issue would be if any sites using classic themes have added featured images to speakers or organizers.
since on classic themes the avatar is prepended to the content, but on Twenty Nineteen, Twenty Seventeen etc, the featured image is also injected in the template and organizers can't remove that.
I was wondering if it could be switched to a has_post_thumbnail filter instead. Featured image being a thumbnail.