How to get override the WP Admin Syndication feed limit for a custom feed?
I thought you could hook into pre_get_posts
, but if it is a feed the posts_per_page
value gets overwritten later. So just hook into post_limits
, check for your feed, and return a different LIMIT
part if needed.
add_filter( 'post_limits', 'so6230475_post_limits', 10, 2 );function so6230475_post_limits( $limits, &$wp_query ){ if ( $wp_query->is_feed( 'json' ) ) { $limits = 'LIMIT 50'; } return $limits;}