wp_query show posts by custom field after a date
I am using custom post types to create an events section. I’d like to show events which will be taking place in the future. The start date is stored in a custom field. I currently have:
$args=array( 'post_type' => 'event', 'posts_per_page' => 5, 'meta_key' => 'start_date', 'orderby' => 'start_date', 'paged' => $paged ); $link = new WP_Query($args);
This works great but returns results sorting by the start time so will show all previous events. I’d like to add a where start_date => current_date.
Any help is much appreciated.
- The topic ‘wp_query show posts by custom field after a date’ is closed to new replies.