Limit RSS feed to previous calendar month
I want to filter my RSS feed to only show posts in the previous calendar month. I have this code in my theme functions file but it is not working?
// filter the RSS feeds to show only the last calendar month
$lastMonthNumber = date( 'n', current_time( 'timestamp' ) ) - 1; // work out the previous month number
function feedFilter($query) {
if ($query-is_feed) {
$query-set('date_query', array(
array(
'month' = $lastMonthNumber
//'month' = 5
)
));
}
return $query;
}
add_filter('pre_get_posts','feedFilter');`
Topic date-query rss filters Wordpress
Category Web