I have a script i use to send e-newsletters (i basically assign a post to a custom post type and those posts are included in the email). The code below used to strip out all images but since a recent update gallery images are now being ignored and are being displayed in $content. Is there a similar way to exclude all images (regular and gallery) via preg_replace? Regular expressions are not my strong suit.
$content = get_the_content();
$content = preg_replace(“/<img[^>]+\>/i”, ” “, $content);
$content = apply_filters(‘the_content’, $content);
$content = str_replace(‘]]>’, ‘]]>’, $content);
- The topic ‘preg_replace gallery images’ is closed to new replies.