How do I get link URLs from the WordPress links backend into an array?

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',
            'http://feeds.feedburner.com/climbingnarc',
            'http://jonglassberg.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); 
endif;
?>

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!

Related posts

Leave a Reply

1 comment

  1. 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 ); 
    }