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

I'm getting an image through getMeta. It returns me the id of the attachment. Now I want to get the titel, alternative text, description and so on.

For the alternative text this works very well:

get_post_meta($logo, '_wp_attachment_image_alt', true);

Now I want to get the title. I found out I can do that with $attachment->post_title, but here I only have the id. How do I get the title for an attachment id?

share|improve this question
up vote 15 down vote accepted

If you have the attachment id, you can use get_the_title()

$attachment_title = get_the_title($attach_id)


share|improve this answer

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.