Support

Account

Home Forums Backend Issues (wp-admin) Show only Upcoming event dates Reply To: Show only Upcoming event dates

  • Hi @lowercase,

    Thanks for the post.

    To query all future events, you will need to incorporate a meta_query within your $args array.

    Your code should then look like so:

    <?php
           $today = date('Ymd');
            $args=array(        
            'post_type' => 'tour-date',        
            'meta_query' => array(
    		array(
    	        'key'		=> 'event_date',
    	        'compare'	=> '>',
    	        'value'		=> $today,
    	    )       
            ),
           );       
                  
            // get posts
            $posts = get_posts($args);
            ?>