Removing iframe tag from feed output

I need to remove an iframe tag that is causing my feed not to work. Here is the url of the validator VALIDATOR. The url of the feed is Natural Nigerian Feed. Please could someone tell me what to do. It’s been very frustrating. Here is the code I have written to handle it but it is not working

function rss_noiframe($content) {
      // filter out iframe here
    $content =  preg_replace( '/<iframe(.*)/iframe>/is', '', $content );
    return $content;
}
add_filter('the_excerpt_rss', 'rss_noiframe');
add_filter('the_content_feed', 'rss_noiframe');
add_filter('the_content_rss', 'rss_noiframe'); 

I put this code inside the template’s function.php but to no avail

Related posts

Leave a Reply

2 comments

  1. this should replace all iframes (upper and lower case)

    function rss_noiframe($content) {
          // filter out iframe here
        $content =  preg_replace( '@<iframe[^>]*?>.*?</iframe>@siu', '', $content );
        return $content;
    }