As a quick fix I just went straight for the SimplePie code that the WordPress code is wrapping around.
$feed = new SimplePie(); $feed->set_feed_url('http://rss.betfair.com/RSS.aspx?format=rss&sportID=7'); $feed->set_timeout(30); // set to 30 seconds $feed->set_item_limit(40); $feed->set_stupidly_fast(true); $feed->enable_cache(true); $feed->set_cache_duration(200); $feed->init(); $feed->handle_content_type();
WordPress の fetch_feed() 関数でタイムアウト値を延ばす方法をググったらサポートのこの回答が出てきたんだけど、wp-includes/feed.php 眺めたら、アクションフックがあったので、こっちで対応できるねというお話。
add_action('wp_feed_options', function(&$feed, $url){
$feed->set_timeout(30); // set to 30 seconds
}, 10, 2);
今日の教訓:ググる前にソースを見よう。
コメントを残す