0

I'm trying to get the custom field data off an attachment and display it following the image tag in a page/post using the get_image_tag filter.

I'm using the same function to get the same data and display it on the attachment field as well. That works perfectly using the the_content filter so I know the function is working ok and the data is being stored and retrieved.

I feel like I'm missing something really obvious. Based on the few other questions I can find about the get_image_tag filter, it seems like there's either something buggy about its implementation or it doesn't run where it seems like it should. I can't even get it to append a string to the resulting $html variable and I don't get an error with wp_debug = true either.

The code is on Pastebin at http://pastebin.com/VRcEyYBh.

1 Answer 1

0

Turned out my "answer" was that I didn't really understand "get_image_tag." It only runs when you first insert an image. I was thinking that it ran every time the edit interface was loaded.

From researching and talking with others, it seems the only way to get the metabox data onto existing images is some kind of regex on the database, probably adding a shortcode around imagines that don't have a caption and do have metabox values. Fun!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.