php – Adding caption to all images inside an article
My client has decided he wants to add inside the article body, for each image, the caption below the img tag.
I know WordPress has this shortcode built in, but since there are more than 300 articles, it would take a lot of time.
test testTo recap, for each tag inside my article body, I want to return that tag and after that a paragraph tag which contains the caption of the image.
I found the wp_get_attachment_image() method but I can’t make the connections when trying to get the article body and filtering those images in order to add the paragraph tag after each image.
Thanks a lot in advance!
Leave an answer