How to add caption to the featured images in WordPress


WordPress came into light with the intend to make blogging easier and better and it still does the same, but only better. Though WordPress is now used more like an application, e-commerce and what not platform, but still a good chunk of sites uses WordPress for blogging.

One of the simplest yet useful thing with WordPress blogging is being able to upload featured image or thumbnail images as many like to say. Most of the themes available in WordPress ( read all 😉 ) uses this featured image thing, but not many uses one of the cool option “caption”, which is what this blog about. Many themes, like Hueman, the one I am using, uses the uploaded image caption to show it with the featured image in the front end. This can be used as a caption for a photo blogging or as an image credit or a thought/phrase related to the featured image.

If your theme doesn’t do this and you don’t want to change the theme but at the same time want this feature, no worries its a matter of few lines of codes and you have it.

When an image is uploaded to the media, it has the option to add an caption to the image, use that field to add the caption.



Now you would need to find the section where the featured image is called. It would be mostly in content.php or single.php or content-single.php or page.php etc and may look like the below or something similar

To add the caption add the below code

so together this will look like below

Now you would have the caption with the featured image, add the custom styling to make it look the way you want and most importantly, don’t forget to make the changes using a child theme.


Maruti Mohanty

I am a happy go lucky WordPress Developer, who loves biking, movies and learning different languages


You may also like...

5 Responses

  1. Nice article !! Could you please add a sample css snippet to display the caption over the image and in nice/bold way ? Thanks 🙂

    • Thanks Subh for the appreciation. This snippet can be used in any theme and basically depending on the theme css would depend and hence I haven’t added it to the blog to avoid any confusion.

  2. serge says:

    Hi i am trying this but does not work out for me , can you help

  3. This was super helpful, thank you so much!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: