RSS feed : a way to limit to the events in the next x days ?
-
Hi !
For a specific use, I need to cap items that are in my feeds.
I was able to set a limit to my (past) posts feeds to the “last 15 days” with the following code:
add_action( 'pre_get_posts', function( $q ) { if( $q->is_feed() && filter_input( INPUT_GET, 'wpse_previous_2_weeks', FILTER_SANITIZE_NUMBER_INT ) ) $q->set( 'date_query', [ [ 'after' => '15 days ago', ] ] );
I would like to add something that would act similarly to cap listed event in the RSS feed to the ones in the “next X days”.
Anyone has an idea on how to proceed for this (ideally though a similar approach than for the posts, otherwise it could be by doing some changes in the RSS template file)
Note: the current “full events” RSS feed is already used by some existing consumers – I need to keep it running.
Thanks for any idea !
Matt
- The topic ‘RSS feed : a way to limit to the events in the next x days ?’ is closed to new replies.