Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Alter "posts_per_rss" option with querystring param to limit the number of posts returned for an RSS Feed
<?php
/**
* Alter "posts_per_rss" option with querystring param to limit the number of posts returned for an RSS Feed.
*/
add_filter( 'option_posts_per_rss', 'my_posts_per_rss' );
function my_posts_per_rss( $option ) {
if( isset( $_GET['limit'] ) ) {
return (int) $_GET['limit'] ?: $option;
}
return $option;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.