WordPress.org

Make WordPress Core

Ticket #9198: 9198.diff

File 9198.diff, 771 bytes (added by rmccue, 5 years ago)

Add PHPDoc and return a WP_Error if needed

  • wp-includes/feed.php

     
    534534        return apply_filters( 'feed_content_type', $content_type, $type ); 
    535535} 
    536536 
     537/** 
     538 * Build SimplePie object based on RSS or Atom feed from URL. 
     539 * 
     540 * @since 2.8 
     541 * 
     542 * @param string $url URL to retrieve feed 
     543 * @return WP_Error|SimplePie WP_Error object on failure or SimplePie object on success 
     544 */ 
    537545function fetch_feed($url) { 
    538546        require_once (ABSPATH . WPINC . '/class-feed.php'); 
    539547 
     
    545553        $feed->init(); 
    546554        $feed->handle_content_type(); 
    547555 
     556        if($feed->error()) { 
     557                return new WP_Error('simplepie-error', $feed->error()); 
     558        } 
    548559        return $feed; 
    549560} 
    550561