WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my theme I want to display the featured image, but I also want to display the title attribute (of the image, not of the post/page) beside the image itself.

Is there a simple way to do this? Where should I be looking?

Thanks, John.

share|improve this question
Can you mark your question as answered since you found the solution. You can answer your own question. This removes it from the unanswered list. – xLRDxREVENGEx May 20 '11 at 17:54


<?php the_post_thumbnail();
echo get_post(get_post_thumbnail_id())->post_excerpt; ?>

Taken from: http://www.billerickson.net/wordpress-featured-image-captions/

share|improve this answer

post_excerpt is actually the caption attribute. Here is the correct answer:

$title = get_post(get_post_thumbnail_id())->post_title; //The Title
$caption = get_post(get_post_thumbnail_id())->post_excerpt; //The Caption
$description = get_post(get_post_thumbnail_id())->post_content; // The Description
share|improve this answer
This is an accurate answer and must be upvoted. – gurung Apr 20 '14 at 15:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.