Displaying only custom post types that's custom date fields values are
either today or in the future
I'm using the following custom WordPress query to display data (events)
from a custom post type on the homepage of my site:
$posts = new WP_Query(array('post_type' => 'events',
'posts_per_page' => '3',
'meta_key' => 'event_date',
'orderby' => 'meta_value_num',
'order' => 'ASC'
));
This works as expected,however, as the nature of events is that they are
always in the future i have a requirement that within the above query i
need to filter out any post that's custom field 'event_date' is in the
past, I also still wish to display, events occurring on the current day.
I've tried post_status => future but this only displays unpublished posts
whereas all of my events are already published. Any insight is much
appreciated Thank you
No comments:
Post a Comment