When uploading an image, WordPress reads the description meta data from the jpg via wp_read_image_metadata
and inserts it into the post_content
field when adding the attachment via media_handle_upload
or media_handle_sideload
But when adding a image to the editor in WordPress, it looks for the caption in the post_excerpt
field via image_media_send_to_editor
What I’d like is just some continuity, in that when our images are uploaded, the field populated by WordPress for the images meta description is the one used for the caption when placing an image in the editor.
Can anyone suggest a way I can hook into any of these functions in order to match up the process? I don’t really care which way I fix it, although I tend to think that post_excerpt
leads to less database overhead since it’s a ‘smaller’ field.
Any help is greatly appreciated.
Thanks.
I wonder if this will work for you:
or with less queries:
where the description (
post_content
) is copied to the caption (post_excerpt
) when theadd_attachment
is fired just after the attachment has been inserted (added).