I got it solved…. function filter_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt) { $animatedGif = (bool) get_post_meta($id, ‘animated_gif’, true); if($animatedGif){ $gifCoverImgUrl = get_post_meta( $id, ‘animated_gif_cover_url’, true ); // build my GIF player if(isset($gifCoverImgUrl) && $gifCoverImgUrl != ”){ $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $src = $xpath->evaluate(“string(//img/@src)”); $html=”<img class=”gifplayer” src=””.$gifCoverImgUrl.'” data-gif=”‘.$src.'” />’; … Read more