I'm currently running a blogroll on a site I'm working on by defining a variable with an array that has all the rss feed urls I want to pull from. Like this for example:

<?php // Get RSS Feed(s)
include_once(ABSPATH . WPINC . '/feed.php');
$rsslist = array(   'http://jordanshipman.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); 

What I would like to figure out is rather than entering in each feed url in the code as above I want to pull the rss links from the wordpress links backend. Using something like the wp_get_bookmarks() function. Any help would be greatly appreciated! Thanks much!


I believe that you're looking for the get_bookmarks() function, which returns an array of bookmark objects. You could then implement this into your code:

<?php // Get RSS Feed(s)
include_once(ABSPATH . WPINC . '/feed.php');

$bookmarks = get_bookmarks();
$rsslist = array();

foreach ( $bookmarks as $bm ) {
    if ( $bm->link_rss )
        $rsslist[] = $bm->link_rss;

$rss = fetch_feed( $rsslist );

if ( ! is_wp_error( $rss ) ) {
    $maxitems = $rss->get_item_quantity(25); 
    $rss_items = $rss->get_items( 0, $maxitems ); 
  • Thanks for that! I had to change your usage/syntax a little (submitted edit) to get it to work but that's the ticket! Sub question: when I manually entered the rss urls into the code the posts in my blogroll were sorted by date. Using this mehtod, all the posts for one rss feed are displayed by date, then another, etc. They are grouped together by feed source rather than all the posts being mixed together sorted by date. Is there a way to fix this? – Jordan Shipman Dec 9 '12 at 22:28
  • Have a look at wordpress.stackexchange.com/q/73539/19726 - it seems that it could be one of your feeds messing things up – shea Dec 10 '12 at 2:06
  • Thanks for the link. That post was helpful when I was getting started putting this together. I don't think it's one of the feeds as everything works fine with the same exact rss urls entered manually. – Jordan Shipman Dec 10 '12 at 2:39
  • I'm sorry then, I can't think of what the problem could be - unless the arrays are structured differently. Perhaps you could post this as a new question? – shea Dec 10 '12 at 2:51
  • No worries! You helped a lot and I appreciate it very much :) I just posted it as a new question here: wordpress.stackexchange.com/questions/75535/… – Jordan Shipman Dec 10 '12 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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