admin管理员组文章数量:1391918
I use the exact same code from Wordpress codex here :
It works as intended with most external RSS i tried to use but for one of them i have the error
A feed could not be found at RSS-URL. A feed with an invalid mime type may fall victim to this error, or SimplePie was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed.
I can't find any information on how to use force_feed with the code $rss = fetch_feed('RSS-URL');
, and i'm 100% sure the external rss code is valid. I think the problem from the RSS is the content type which is xml
and not rss+xml
.
Any help appreciated, thanks !
I use the exact same code from Wordpress codex here : https://codex.wordpress/Function_Reference/fetch_feed#Example
It works as intended with most external RSS i tried to use but for one of them i have the error
A feed could not be found at RSS-URL. A feed with an invalid mime type may fall victim to this error, or SimplePie was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed.
I can't find any information on how to use force_feed with the code $rss = fetch_feed('RSS-URL');
, and i'm 100% sure the external rss code is valid. I think the problem from the RSS is the content type which is xml
and not rss+xml
.
Any help appreciated, thanks !
Share Improve this question asked Jul 20, 2016 at 14:26 Aurélien GrimpardAurélien Grimpard 1131 silver badge5 bronze badges1 Answer
Reset to default 1If we peek into the fetch_feed()
function we see the instantiation:
$feed = new SimplePie();
where the object is made accessible through the wp_feed_options
hook via:
do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
where $feed
is passed by reference.
This means we can adjust that object instance through the hook, before the $feed->init()
is called within fetch_feed()
.
I searched this site for examples for you and found only one here by @Firsh. that sets $feed->force_feed(true)
through the wp_feed_options
hook.
本文标签: rssHow to use forcefeed with fetchfeed
版权声明:本文标题:rss - How to use force_feed with fetch_feed 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744589550a2614402.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论