Picture is not in enclosure tag but in content tag.
-
Hi!
I have changed the code to have a fall-back if no picture is found in enclosure tag. Many RSS feeds includes the image in the content tag. Here my code:
// import picture_url $picture_url = ''; if ( $use_simplepie ) { if ( $enclosure = $item->get_enclosure() ) { $picture_url = wp_filter_kses( $enclosure->get_thumbnail() ); } if ( empty($picture_url) && preg_match('/<img.+?src="(.+?)"/', $item->get_content(), $matches) ) { $picture_url = wp_filter_kses( $matches[1] ); } }
- The topic ‘Picture is not in enclosure tag but in content tag.’ is closed to new replies.