I have this code for my 2 custom rss feeds:
add_action( 'init', 'custom_feeds' );
function custom_feeds()
{
foreach( array( 'custom1', 'custom2' ) as $name )
{
add_feed( $name,
function() use ( $name )
{
get_template_part( 'rss', $name );
}
);
}
}
function feedFilter($query) {
if ($query->is_feed) {
$query->set('cat', '7');
$query->set('posts_per_page','5');
}
return $query;
}
add_filter('pre_get_posts','feedFilter');
I wanted to put filter on custom2
only, like filter the feed by category 7
only; But my filter is affecting all the rss feeds.