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 need to override the setting in the WP Admin for the number of recent posts in the Syndication settings under General -> Admin.

I'm using the following code, which gets all posts, but I don't need that many. Can someone tell me how to retrieve 50 posts?

function no_limits_for_feed( $limits ) {
    return '';

add_filter( 'post_limits', 'no_limits_for_feed' );
share|improve this question
up vote 0 down vote accepted

This is no normal filter. It's a filter_ref_array.

// Use this to alter your limit:
add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) );


After I saw that this got marked as solution, I want to show you a more "best practice"-approach:

function alter_feed_post_limits( $limits )
    return " LIMIT 0,50";
add_action( 'post_limits', 'alter_feed_post_limits' );
share|improve this answer
This doesn't appear to be working for me. I'm getting 0 results after adding that line. Any ideas? – Zoolander May 31 '11 at 15:38
Take a look at the link. I just gave you a starting point. – kaiser May 31 '11 at 16:06
Actually there is nothing special about such filter, the way it is called is merely internal stuff and you add to it like usual. – Rarst Aug 25 '11 at 21:55

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.