Adding this snippet to the functions.php of your WordPress theme will automatically wrap images in the_content with any custom HTML that you wish.
function filter_images($content){ return preg_replace('/<img (.*) \/>\s*/iU', '<span class="className"><b><img \1 /></b></span>', $content); } add_filter('the_content', 'filter_images');
Leave a Reply