我正在尝试从另一个WordPress站点的RSS提要获取和显示项目。
我以前做过这类事情,但这一次,我获取的RSS提要有这样的“特色”图片:
<enclosure url="https://cdn.canpl.ca/app/uploads/cpl/2022/01/10102550/DJC07504-e1641828489467-730x365.jpg" length="0" type="image/jpeg"/>
现在,我完全知道一旦它被归还,我需要做什么,这根本不是问题。。。但后来WordPress MagpieRSS决定做它的事情。。。当我使用以下方式获取提要时:
$rss_feed = @fetch_rss( $rss_src );
实际上我不明白<enclosure>
已返回标记。所以看起来WP正在剥离这些。这个var_dump($rss_feed)
显示:
object(MagpieRSS)#1266 (20) { ["parser"]=> NULL ["current_item"]=> array(0) { } ["items"]=> array(15) { [0]=> array(9) { ["points"]=> string(2) "10" ["title"]=> string(97) "WATCH: CPL Commissioner David Clanachan’s exclusive interview following Monday’s announcement" ["link"]=> string(112) "https://canpl.ca/link/watch-cpl-commissioner-david-clanachans-exclusive-interview-following-mondays-announcement" ["pubdate"]=> string(31) "Mon, 10 Jan 2022 17:33:08 +0000" ["guid"]=> string(112) "https://canpl.ca/link/watch-cpl-commissioner-david-clanachans-exclusive-interview-following-mondays-announcement" ["description"]=> string(20) " " ["content"]=> array(1) { ["encoded"]=> string(20) " " } ["summary"]=> string(20) " " ["atom_content"]=> string(20) " " } [1]=> array(9) { ["points"]=> string(2) "10" ["title"]=> string(124) "Commissioner David Clanachan Awarded Exclusive CPL Rights to Windsor/Essex County and to Step Down as First CPL Commissioner" ["link"]=> string(148) "https://canpl.ca/article/commissioner-david-clanachan-awarded-exclusive-cpl-rights-to-windsoressex-county-and-to-step-down-as-first-cpl-commissioner" ["pubdate"]=> string(31) "Mon, 10 Jan 2022 17:15:02 +0000" ["guid"]=> string(148) "https://canpl.ca/article/commissioner-david-clanachan-awarded-exclusive-cpl-rights-to-windsoressex-county-and-to-step-down-as-first-cpl-commissioner" ["description"]=> string(20) " " ["content"]=> array(1) { ["encoded"]=> string(9517) "
真的不知道还能去哪里。我确实找到了一个MagpieRSS修补程序插件,它实际上只是取代了WordPress中的整个MagpieRSS功能,并打算看看正在做什么,但该插件已经13年没有更新了,所以不确定该代码的可靠性。有人知道我怎样才能让WordPress停止剥离<enclosure>
标签