I have two RSS feed on my WordPress blog:

  1. mydomain.com/feed/
  2. mydomain.com/feed/anotherfeed/

Is it possible to set different items limits on these? I want to show 10 items for the first feed, but the second I want to show 30 items.

Thanks in advance

1 Answer
1

Sure, you can. First create the feed as per codex:

function anotherfeed_init(){
    add_feed('anotherfeed');
}
add_action('init', 'anotherfeed_init');

Now, change the post count for this particular feed:

function anotherfeed_post_count( $query ) {
    if( $query->is_main_query() && is_feed('anotherfeed') )
        $query->set( 'posts_per_rss', 30 );
}
add_action( 'pre_get_posts', 'anotherfeed_post_count' );

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *