Title: Filter for current and future dated posts
Last modified: April 3, 2019

---

# Filter for current and future dated posts

 *  Resolved [stevebeavis](https://wordpress.org/support/users/stevebeavis/)
 * (@stevebeavis)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/filter-for-current-and-future-dated-posts/)
 * Thanks for the plugin which is very useful. I have successfully created a sorted
   list of a particular category from a directory created with Web 2.0 directory
   plugin using the shortcode:
 * [display-posts post_type=”w2dc_listing” taxonomy=”w2dc-category” tax_term=”events”
   meta_key=”_content_field_12_date_start” orderby=”meta_value_num” order=”DESC”]
 * I am trying to get a filter working to show only future dated events and not 
   past dated events by adapting one of the filters you have provided on your site:
 * ———-
    function be_dps_future_events( $args, $atts ) {
 *  // Only run on directory queries
    if( ‘w2dc_listing’ != $args[‘post_type’] )
   return $args;
 *  $args[‘order’] = ‘ASC’;
    $args[‘orderby’] = ‘meta_value_num’; $args[‘meta_key’]
   = ‘_content_field_12_date_start’; $args[‘meta_type’] = ‘datetime’;
 *  $args[‘meta_query’] = array(
    array( ‘key’ => ‘_content_field_12_date_start’,‘
   value’ => date( ‘dd-mm-yyyy H:i:s’, current_time( ‘timestamp’ ) ), ‘compare’ 
   => ‘>’ ) );
 *  return $args;
    } add_filter( ‘display_posts_shortcode_args’, ‘be_dps_future_events’,
   10, 2 ); —————————-
 * But my list which can be seen below the calendar on this page:
 * [http://eflowriders.concisedigital.net/calendar-test/](http://eflowriders.concisedigital.net/calendar-test/)
 * Is still showing all the events in the category including those with a past start
   date.
 * Any idea why my future events filter is not working?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Bill Erickson](https://wordpress.org/support/users/billerickson/)
 * (@billerickson)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/filter-for-current-and-future-dated-posts/#post-11449887)
 * I believe the issue is your meta query is not a simple number. Inside $args[‘
   meta_query’], try adding `'type' => 'DATETIME'`.
 * More information: [https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters](https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters)

Viewing 1 replies (of 1 total)

The topic ‘Filter for current and future dated posts’ is closed to new replies.

 * ![](https://ps.w.org/display-posts-shortcode/assets/icon-256x256.jpg?rev=2940963)
 * [Display Posts - Easy lists, grids, navigation, and more](https://wordpress.org/plugins/display-posts-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/display-posts-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/display-posts-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/display-posts-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/display-posts-shortcode/reviews/)

## Tags

 * [dates](https://wordpress.org/support/topic-tag/dates/)
 * [events](https://wordpress.org/support/topic-tag/events/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [sorting](https://wordpress.org/support/topic-tag/sorting/)

 * 1 reply
 * 2 participants
 * Last reply from: [Bill Erickson](https://wordpress.org/support/users/billerickson/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/filter-for-current-and-future-dated-posts/#post-11449887)
 * Status: resolved