0

When I use fetch_feed() to pull in posts from a feed, even if I set the maximum posts variable to a very high number, it will only pull in 10 posts. I want to pull in all the posts and then paginate the way I would for my regular blog posts. I thought maybe it was set to the number in my Reading settings, but I changed it to 30 with no change. There are definitely more than 10 posts in the feed I am trying to pull in. Is this possible or is this inherently limited for this function?

1

It sounds like your source feed is showing only 10 posts. So, regardless of what you pit for get_item_quantity, only 10 posts will show, max.

If you're pulling posts from a WordPress site, you can adjust how many posts are included in the RSS feed in Settings -> Reading.

Change this value: "Syndication feeds show the most recent"

3

If someone happens upon this and doesn't have the option to change the feed length, my solve was to use an array of feed pages:

fetch_feed( array('http://example.com/feed/', 'http://example.com/feed/?paged=2', 'http://example.com/feed/?paged=3') );
1

from wordpress codex: http://codex.wordpress.org/Function_Reference/fetch_feed

    // Figure out how many total items there are, but limit it to 5. 
$maxitems = $rss->get_item_quantity(5); 

// Build an array of all the items, starting with element 0 (first element).
$rss_items = $rss->get_items(0, $maxitems); 

change the $maxitems to whatever you want. hope this is what you were looking for.

  • Thank you, but I should have been more clear. What I meant by "even if I set the maximum posts variable to a very high number, it will only pull in 10 posts" was that I changed maxitems = $rss->get_item_quantity(5); to maxitems = $rss->get_item_quantity(99); This didn't change the number of posts. – laurayeffeth Mar 13 '13 at 22:41

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.