Shortcode to display tags for each image in a post
-
Is there a shortcode that I can insert before or after each image in a post that will utilize the function “
list_mediatags
” – to display the tags for the specified image? For example, if I insert the following on a post with just one image:<img src="https://www.example.com/wp-content/uploads/2016/05/image_91.jpg" /><br /> [tags]
This would return image_91.jpg, and a list of all the tags associated with that image.
However, I would like to do the following:
<img src="https://www.example.com/wp-content/uploads/2016/05/image_91.jpg" /><br /> [tags id="91"] <img src="https://www.example.com/wp-content/uploads/2016/05/image_95.jpg" /><br /> [tags id="95"]
I have this working with a single image, using the shortcode, “
[tags]
“, but sometimes I have more than one image in a post. How do I modify the “list_mediatags
” function to lookup the associated tags for a specified image id?
- The topic ‘Shortcode to display tags for each image in a post’ is closed to new replies.