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' );

1 Answer 1


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' );
  • This doesn't appear to be working for me. I'm getting 0 results after adding that line. Any ideas?
    – Zoolander
    May 31, 2011 at 15:38
  • Take a look at the link. I just gave you a starting point.
    – kaiser
    May 31, 2011 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, 2011 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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