[wp-trac] [WordPress Trac] #12059: fetch_feed($feedURL) throws an error when passed a bad feed...
WordPress Trac
wp-trac at lists.automattic.com
Thu Jan 28 00:48:21 UTC 2010
#12059: fetch_feed($feedURL) throws an error when passed a bad feed...
-----------------------------+----------------------------------------------
Reporter: wickedbrilliant | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Feeds | Version: 2.9
Severity: normal | Resolution: worksforme
Keywords: fetch, feed |
-----------------------------+----------------------------------------------
Changes (by nacin):
* status: new => closed
* resolution: => worksforme
* milestone: Unassigned =>
Comment:
On failure, fetch_feed() returns a WP_Error object instead of a Simplepie
error. (You can see how this works by
[http://core.trac.wordpress.org/browser/trunk/wp-
includes/feed.php?rev=12883#L512 looking at the code directly].)
Thus, you'll need to do something like this:
{{{
$feed = fetch_feed( $url );
if ( is_wp_error( $feed ) ) {
echo $rss->get_error_message(); // a method of WP_Error
} else {
// do your stuff here
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12059#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list