I have set up a custom post-type with custom meta boxes for dates – the format the data is saved in is Year-Month-Day (e.g.. 2013-07-27). I’m not using the WP post date.
My query to retrieve posts is as follows:
$args = array( 'post_type' => 'listings','meta_key' => 'usp_startdate', 'orderby' => 'meta_value','order'=>'DESC'); $query = new WP_Query($args);
This works fine to retrieve all posts, however I am trying to find a way to ONLY get posts between specific dates/years. I know I can sort data once retrieved but is there a good way of doing this in the query?
Any help would be appreciated
- The topic ‘Help with WP_Query’ is closed to new replies.