WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to display multiple feeds using the fetch_feed function. Its working well thus far except I can't figure out why the title for each individual rss feed will not show up. Here is my code:

<?php // Get RSS Feed(s)
include_once(ABSPATH . WPINC . '/feed.php');
$rsslist = array(   'http://www.lt11.com/rss',
$rss = fetch_feed($rsslist);
if (!is_wp_error( $rss ) ) : 
$maxitems = $rss->get_item_quantity(25); 
$rss_items = $rss->get_items(0, $maxitems); 
    <?php if ($maxitems == 0) echo '<li>No items.</li>';
    foreach ( $rss_items as $item ) : ?>
    <li class="feed"> 
        <a href='<?php echo esc_url( $item->get_permalink() ); ?>'
        title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
        <?php echo esc_html( $item->get_date('j/n/Y - g:i A') ); ?> - <div class="feeditemtitle"><?php echo esc_html( $item->get_title() ); ?></div> - <?php echo esc_html($rss->get_title() ); ?></a>
    <?php endforeach; ?>        

Its that list bit that calls for the title of the rss feed. If I only fetch one feed then the title shows up. When I fetch more than one feed as in the example above, the title does not show up. Any ideas on how to fix this? Thanks!

share|improve this question
up vote 1 down vote accepted

I don't see anything to suggest that fetch_feed is supposed to accept an array of values. That is not mentioned in the Codex, nor the source, @param string $url URL to retrieve feed.

That said, fetch_feed passes things off to SimplePie's set_feed_url($url); which does accept an array. And that Simplepie docs page is, I think, where your answer is. The RSS feed name is $item->get_feed()->get_title() not $rss->get_title()

I am still a bit cautious since you are passing an array through a WordPress function that doesn't appear to be meant for it.

share|improve this answer
Passing an array in is fine; the WordPress function is just incorrectly documented, see WP bug #22140. – Ryan McCue Dec 4 '12 at 2:54
Thanks @RyanMcCue. Looks like there is a patch for the source documentation. Maybe I'll straighten out the Codex. – s_ha_dum Dec 4 '12 at 5:01
@s_ha_dum Thank you so much! That worked like a charm! :) – Jordan Shipman Dec 4 '12 at 17:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.