Wordpress get attachment image caption
<p>I tried to get attachment meta caption value as <a href="http://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata" rel="noreferrer">mentioned here</a>, but couldn`t get any output. Other meta arrays like [created_timestamp] or [iso] gave their values.</p>

<pre><code>$img_meta = wp_get_attachment_metadata( $id );
echo $img_meta[image_meta][caption];
</code></pre>

<p>This issue happens to both [caption] and [title]. Any help is much appreciated.</p>