Support » Developing with WordPress » fetch_feed not working with array of URLs

  • I’m trying to call fetch_feed with an array of URLs as the argument and this is what I get:

    
    WP_Error Object
    (
        [errors] => Array
      (
          [simplepie-error] => Array
        (
            [0] => Array
          (
              [1] => WP HTTP Error: cURL error 6: Could not resolve host: array
          )
    
        )
    
      )
    
        [error_data] => Array
      (
      )
    
    )
    

    According to the Codex, the argument is “The URI of the RSS feed you want to retrieve. If an array of URIs, the feeds are merged using SimplePie’s multifeed feature.” But the previous error occurs because I’m using an array.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Can you show exactly how you’re passing this array to the function?

    Sure:

    
    $feeds     = get_option( 'nc_feeds', array() );
    $feed_urls = array();
    foreach ( $feeds as $feed ) {
      array_push( $feed_urls, $feed['feed'] );
    }//end foreach
    
    $rss = fetch_feed( $feed_urls );
    

    Surprisingly, this works on my testing environment (where I use VVV), but it doesn’t in the site of one of our customers…

    Nobody? 🙁

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.