You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Post Featured Image]: add option to display image caption/credit #40946
When using a block theme that leverages wp:post-featured-image to display a post's featured image, there is no caption being rendered by that block, nor is there an option to do so.
Jetpack for example offers external media providers like Openverse and Pexels that users can select from when setting a featured image. Generally, the Caption field is used to credit the source, and you'll see that themes like Twenty Twenty will render the caption/credit for featured images by default.
I'm not quite sure at this point, but I think it'd be nice to have an option that would show the caption/credit for the featured image - especially when the images are sourced from a third-party. At bare minimum, at least have the figcaption output in the HTML even if it's not visually displayed.
@kaffeeringe even in classic PHP based themes, displaying the description is a custom solution.
Chances are that this field will never be supported by the block by default. You may want to consider moving the data to another field in your database, like the caption.
I learnt that none of the media captions use the caption text from the media library.
So if we want the caption to use the media library data by default, they all need to be updated, not only the post featured image block.
I want to read up on the history and why this choice was made.
It is probably because the same media can be used in multiple places and one caption may not be enough because it is situational. But it has that side effect that existing data is not easily available.
@carolinan Sorry, I mixed up the fields. I use Wordpress in German and there caption and description are called "Beschriftung" and "Beschreibung" and I always mix them up. I use the caption field with my images.
It would be nice if the caption was only the suggested caption if you use an image in a block or as featured image. So you can reuse an image with different captions.
I'm refactoring a couple of websites into FSE, and I really wish this was available in the Featured Image block. (I don't need it for copyright declarations, but sure would like it for traditional captions.
I agree that the ability to show captions on featured images should be rolled into WP. Until then, I came up with the following workaround:
Set up a block variation. "For now, let’s create variations.js and put the file in our theme’s assets/js folder":
wp.blocks.registerBlockVariation('core/post-featured-image',{name: 'sotp_post_featured_image',title: 'Post Featured Image + Caption',description: 'Displays the post\'s featured image with caption.',isActive: ['namespace'],attributes: {namespace: 'sotp_post_featured_image',className: 'sotp-post-featured-image'},scope: ['inserter']});
"Next, you need to enqueue variations.js... This code should generally be placed in your theme’s functions.php..."
Wondering about this since another user asked about it today. I'd love to see the ability to put credits / captions on featured images, especially with Openverse. :)
I just had the issue myself that I wanted to display the caption below a featured post image. (Using TT4, caption is saved with the image in the media library). Unfortunately, this was not possible.
As mentioned above, I would love the caption option to be added to the "Post Featured image" block like in the "Image" block. But different to the "image" block, I would prefer that the display of the caption is opt-in and not opt-out. This way, users are not confused, when suddenly captions appear under their featured post images.
Actually, it could be the easiest way to promote the OpenVerse, if the caption plus the licence would include a direct link to the openverse. Right, Matt?
I've made plugin to implement this in the Featured Image block by adding an "Add caption" button to the block toolbar, the same button that appears in the Image block. When selected, a placeholder caption is displayed in the Site Editor and the current caption is rendered in a figcaption on the frontend like @jethin does in #40946 (comment). Writeup: Adding Caption & Lightbox to the Featured Image Block.
Reacted by Derek Hanson, Steffen Voß, Fabian Todt and Fabian Gigler
We also would find this useful. Our post template displays the post featured image, and it's critical for us that there is an accessible way to add a caption beneath it for image attribution and/or other caption context. Thanks @westonruter for the workaround--it would be great if this could be added to core.
Activity
kaffeeringe commentedon Nov 25, 2022
I can't use Gutenberg themes, until it displays the
descriptioncaption. I stored all the copyright notices there.hagege commentedon Dec 31, 2022
That would indeed be a nice option, e.g. by ticking in the properties whether that should be shown.
carolinan commentedon Jan 2, 2023
@kaffeeringe even in classic PHP based themes, displaying the description is a custom solution.
Chances are that this field will never be supported by the block by default. You may want to consider moving the data to another field in your database, like the caption.
carolinan commentedon Jan 4, 2023
I learnt that none of the media captions use the caption text from the media library.
So if we want the caption to use the media library data by default, they all need to be updated, not only the post featured image block.
I want to read up on the history and why this choice was made.
It is probably because the same media can be used in multiple places and one caption may not be enough because it is situational. But it has that side effect that existing data is not easily available.
kaffeeringe commentedon Jan 4, 2023
@carolinan Sorry, I mixed up the fields. I use Wordpress in German and there caption and description are called "Beschriftung" and "Beschreibung" and I always mix them up. I use the caption field with my images.
It would be nice if the caption was only the suggested caption if you use an image in a block or as featured image. So you can reuse an image with different captions.
carolinan commentedon Jan 4, 2023
It could be used as a pre-filled placeholder, interesting idea.
greening commentedon Jun 19, 2023
I'm refactoring a couple of websites into FSE, and I really wish this was available in the Featured Image block. (I don't need it for copyright declarations, but sure would like it for traditional captions.
jethin commentedon Aug 17, 2023
Greetings,
I agree that the ability to show captions on featured images should be rolled into WP. Until then, I came up with the following workaround:
Set up a block variation. "For now, let’s create variations.js and put the file in our theme’s assets/js folder":
"Next, you need to enqueue variations.js... This code should generally be placed in your theme’s functions.php..."
And finally filter the block render (functions.php):
I make no guarantees for this code. Hope it helps someone.
[updated enqueuing as per @janvitos comment below.]
janvitos commentedon Aug 21, 2023
Works like a charm, thanks @jethin!
Just one thing: How do you register your block variation? Using PHP?
I did it this way, but I'm not sure it's the "proper way":
kevinpoot commentedon Sep 21, 2023
IMO this should definitely be included inside the block with an option to disable (or enable) it. Any update on this being implemented anytime soon?
belisama commentedon Sep 27, 2023
Screenshots: https://wordpress.org/support/topic/caption-for-post-featured-image/
supernovia commentedon Oct 25, 2023
Wondering about this since another user asked about it today. I'd love to see the ability to put credits / captions on featured images, especially with Openverse. :)
nickbohle commentedon Jan 4, 2024
Hi all,
I just had the issue myself that I wanted to display the caption below a featured post image. (Using TT4, caption is saved with the image in the media library). Unfortunately, this was not possible.
As mentioned above, I would love the caption option to be added to the "Post Featured image" block like in the "Image" block. But different to the "image" block, I would prefer that the display of the caption is opt-in and not opt-out. This way, users are not confused, when suddenly captions appear under their featured post images.
iamtakashi commentedon Apr 9, 2024
+1 !!
nickbohle commentedon Apr 11, 2024
Actually, it could be the easiest way to promote the OpenVerse, if the caption plus the licence would include a direct link to the openverse. Right, Matt?
dhanson-wp commentedon Apr 12, 2024
+1 !!!!! to the featured image caption, and an alt text field in the block settings.
noellesteegs commentedon Apr 17, 2024
Thank you @jethin for the workaround. I think this feature would make a great addition.
jordonrupp-dev commentedon Aug 12, 2024
+1
westonruter commentedon May 18, 2025
I've made plugin to implement this in the Featured Image block by adding an "Add caption" button to the block toolbar, the same button that appears in the Image block. When selected, a placeholder caption is displayed in the Site Editor and the current caption is rendered in a
figcaptionon the frontend like @jethin does in #40946 (comment). Writeup: Adding Caption & Lightbox to the Featured Image Block.JiveDig commentedon Jun 25, 2025
@westonruter Thanks for the plugin, it works great.
This should definitely be in core, but I'm glad we have that quick plugin option for now.
nathan-barlow commentedon Aug 4, 2026
We also would find this useful. Our post template displays the post featured image, and it's critical for us that there is an accessible way to add a caption beneath it for image attribution and/or other caption context. Thanks @westonruter for the workaround--it would be great if this could be added to core.