1

I'm using a custom post type 'votes' and am using the Advanced Custom Fields plugin to add additional fields to store data, one of which is a date. The data is stored as a string (long text)

meta_key of **completion_date** 

stored in the format of **2015-01-09 16:48:37**

I am wondering what to add to the following query to pull only posts which have a completion date of this current month, ones which have a completion date within this year.

And finally a way to order query posts by this string date?

$args = array (
    'post_type'              => 'votes',
    'meta_query'             => array(
        array(
            'key'       => 'status',
            'value'     => 'Completed',
        ),
    ),
);

$query = new WP_Query( $args );

I have read lots of posts online about it but am getting confused now as some seem that it can be done without modifications and others mention the strtotime() functions.

halfer
  • 19,824
  • 17
  • 99
  • 186
Gary Stewart
  • 161
  • 2
  • 11

0 Answers0