Add new data attribute into get_image_tag function
-
When the “get_image_tag” function is called it results in the following image tag added into the HTML code
<img src=”https://www.domain.com/wp-content/uploads/2010/06/image-demo.jpg” alt=”” title=”image demo” width=”30″ height=”43″ class=”aligncenter size-full wp-image-1525″ />
Presently I’m trying to implement a jQuery plugin that needs a custom HTML5 data attribute. Something like data-href=”image-demo.jpg”
Basically I need to change the original output to:
<img data-href=” https://www.domain.com/wp-content/uploads/2010/06/image-demo.jpg” src=”https://www.domain.com/wp-content/uploads/2010/06/image-demo.jpg” alt=”” title=”image demo” width=”30″ height=”43″ class=”aligncenter size-full wp-image-1525″ />
Is this possible with a filter that I can add to functions.php? Someone knows the code that I should use?
Many thanks for your support.
- The topic ‘Add new data attribute into get_image_tag function’ is closed to new replies.