How to remove iframe when have a post id in wordpress?

I have a simple code:

function filter_widgets($content) {
   global $post;
   if($post->ID = 1210) {
       $content = preg_replace('/<p>s*(<iframe .*>*.</iframe>)s*</p>/iU', '', $content);
   }
   return $content; 
}
add_filter('the_content', 'filter_widgets');

But when run postId=1210 is result can’t iframe, how to fix it?

Related posts

Leave a Reply

1 comment