
Adds caption functionality to Featured Image blocks with a simple checkbox setting.
| Author: | ivans3m (profile at wordpress.org) |
| WordPress version required: | 6.6 |
| WordPress version tested: | 7.2 |
| Plugin version: | 1.1.0 |
| Added to WordPress repository: | 02-10-2025 |
| Last updated: | 02-10-2025 |
| Rating, %: | 0 |
| Rated by: | 0 |
| Plugin URI: | |
| Total downloads: | 740 |
| Active installs: | 30+ |

Click to start download
|
FoA Featured Image – Show Caption is a simple WordPress plugin that extends the core Featured Image block with caption functionality. When enabled, it displays the image caption (or title if no caption exists) below the featured image.
Key Features:
- Adds a “Show Caption” checkbox setting to the Featured Image block
- Displays the image caption (or title if no caption) below the featured image
- Works with the Gutenberg block editor and templates
- Clean, minimal styling that works with most themes
- Right-aligned caption with light grey color
How it Works:
- The plugin extends the core Featured Image block with additional settings
- When “Show Caption” is enabled, it checks for a caption on the featured image
- If no caption exists, it falls back to using the image title
- The caption is displayed in a
<div class="featured-image-caption"> element
- Works with both regular posts/pages and WordPress templates
Styling:
The plugin includes default CSS styling for the caption:
* Text aligned to the right
* Light grey color (#999)
* Italic font style
* Small font size
You can easily customize the appearance by targeting the .featured-image-caption class in your theme’s CSS. The plugin uses standard CSS specificity, so your theme styles will override the defaults.
FAQ
How do I use this plugin?
- Add a Featured Image block to your post, page, or template
- Set a featured image for the post/page
- In the block settings panel, toggle “Show Caption” to ON
- Optionally configure “Fallback to image title” and “Caption alignment”
Does this work with WordPress templates and Query Loops?
Yes! The plugin resolves the post ID from block context first, so it works reliably in Single Post templates, Query Loop blocks, and standard posts/pages.
Can I include links or formatting in my featured image caption?
Yes. Captions are sanitized with wp_kses_post(), so links and inline formatting (like <a>, <em>, <strong>) are preserved.
Can I customize the caption styling?
Yes! The caption uses <figcaption class="featured-image-caption wp-element-caption">, so it automatically inherits your block theme’s theme.json caption styles and can also be customized via .featured-image-caption.
What if my image doesn’t have a caption?
By default, the plugin falls back to the image title. You can turn off “Fallback to image title” in the block settings if you prefer to hide the caption when none is set.
ChangeLog
1.1.0
- Confirmed compatibility with WordPress 7.2 and PHP 8.6
- Switched caption markup to semantic
<figcaption class="featured-image-caption wp-element-caption">
- Fixed HTML nesting when “Link to post” is enabled on the Featured Image block
- Fixed regex backreference corruption when captions contain
$ or \ characters
- Fixed post context resolution inside Query Loop blocks using
$instance->context['postId']
- Added live caption preview inside the Block Editor and Site Editor
- Added “Fallback to image title” toggle (defaults to on for backward compatibility)
- Added “Caption alignment” selector (Right, Left, Center, Theme default)
- Allowed safe inline HTML in captions via
wp_kses_post() and added foafic_featured_image_caption_text / foafic_featured_image_caption_html filters
- Enqueued frontend stylesheet conditionally only when a caption is actually rendered
- Improved default caption contrast (
color: inherit; opacity: 0.75) for light and dark themes
- Migrated editor script build to
@wordpress/scripts, removed deprecated wp-editor dependency, fixed editor Fragment wrapper, and added JS script translations
- Synced repository and fixed undefined constant / array key typos
1.0.0
- Initial release
- Added Show Caption toggle to Featured Image blocks
- Displays image caption or title below featured image
- Works with Gutenberg block editor and templates
- Right-aligned caption styling with light grey color