So, I’m no big fan of how WP stores images (image data) and I was hoping there had been made some improvements in version 4.x. But alas no.
When I say image data, I mean url, title, caption, alt text, description
data that you can update in the media gallery.
wp_get_attachment_image
only returns a URL with this data
wp_get_attachment_image_src
only returns url
get_attached_media( 'image' )
returns some data:
public 'post_content' => string 'This is the description'
public 'post_title' => string 'This is the title'
public 'post_excerpt' => string 'This is the caption'
public 'guid' => string 'http://somesite.com/wp-content/uploads/2015/10/test.jpg'
After I removed the attachment (and deleted the image), then attached another image, get_attached_media( 'image' )
returns empty.
So IS there any good way of getting image data?