E&T Filter: Display Scheduled (Future-Dated) Feed Items

There are times when you might need to use an RSS feed that has posts scheduled in the future, such as an events feed. 

For this reason, we’ve put together these two filters, both of which show options for  only future items, and both future and past items. In the second example, the feed source IDs used (100, 200) need to be changed to the IDs of your own feed sources.

Apply the Filter to All Feed Sources

add_filter( 'wprss_display_feed_items_query', 'my_show_future_events', 10, 2 );
function my_show_future_events( $args, $settings ) {
    $args['order'] = 'ASC';
    // to show future-dated items only, uncomment the line below
    // $args['post_status'] = array('future');
    // to show both future-dated and past items, uncomment the line below
    // $args['post_status'] = array('publish', 'future');

    return $args;

NOTE: To uncomment a line, as requested in the above filter's comments, remove  the   // at the beginning of the line.

Apply the Filter to Selected Feed Sources Only

add_filter( 'wprss_display_feed_items_query', 'my_show_future_stories', 10, 2 );
function my_show_future_stories( $args, $settings ) {
        // replace 100 and 200 with your own feed source IDs.
        // you can add as many as you like, or even just one.
	$allowed_sources = array('100', '200'); 
	$order = 'ASC';
	// to show future-dated items only
	$status = array('future');
	// to show both future-dated and past items
	// or add other status codes as needed
	// $status = array('publish', 'future');
	if (!isset($args['meta_query'])) {
        $args['order'] = $order;
        $args['post_status'] = $status;
		return $args;
	if (!is_array($args['meta_query'])) {
		return $args;
	$meta_query = $args['meta_query'];
	foreach ($meta_query as $_idx => $_meta) {
		if ($_meta['key'] !== 'wprss_feed_id'
				|| !isset($_meta['value'])) {
		$value = is_array($_meta['value'])
			? $_meta['value']
			: array($_meta['value']);
		$matched_values = array_intersect($value, $allowed_sources);
		if (!count($matched_values)) {
        $args['order'] = $order;
        $args['post_status'] = $status;
    return $args;

How do I add this to my site?

Follow the step-by-step instructions below to add this filter to your WordPress site.

  1. Copy the code you need from above.
  2. Go to your WordPress site's dashboard.
  3. Go to Plugins > Add New.
  4. Search for Code Snippets, then install and activate the plugin.
  5. Once installed and activated, go to Snippets in your dashboard menu.
  6. Click on Add New.
  7. Add a Title, which could be the title of this article.
  8. Paste the code you copied in step 1 to the Code section.
  9. Add a Description or Tags if you wish to do so. It is not required.
  10. Click on Save Changes and Activate to save the filter and activate it.
    1. Or click on Save Changes to save the filter and activate it later.
  11. Your action or filter is now stored and active on your site.

Still need help? Contact Us Contact Us