I have looked up all the web but nothing worked out for me. What i am trying to do is get the attached image’s title and description which you give in media library where you also have caption, alt text and description. i want that title to show in title attribute in html like so:
<a href="http://somelink.com/" title="here i want to fetch that title">
Keep in mind i am trying to output a gallery shortcode in a page here.
Read more here: Get image title and description attributes in wordpress