I’m trying to implement the JAIL javascript into my WordPress install. The javascript requires me to add a data-attribute and change the output html of images.
I have been looking through the codex for filters or hooks that can help me, but i can’t find anything. Anyone have a solution?
Your better off adding your custom image data when you insert it into a post using
media_send_to_editor
, the caveat is this will not be applied to any existing images, only ones inserted after adding the function.To apply it to to existing content you will have use
preg_match
onthe_content
filter, but this can significantly slow your site down, it is advised you don’t parse the output like this.A
media_send_to_editor
example: