title: Wordpress Events Orderby Meta Value Date
body: <p>I'm having some trouble getting an arguments array to sort an event list by the date in Wordpress. I've found several suggested solutions here on Stack Overflow and elsewhere, but none of the solutions seem to work after lots of trial and error.</p>
  
  <p>It's nothing fancy, and it should be a lot easier than this. Maybe it is easier and I'm just overthinking it? Any help is greatly appreciated.</p>
  
  <p>I've got a custom Date Field inside the Post using the plugin <a href="http://www.advancedcustomfields.com" rel="nofollow">http://www.advancedcustomfields.com</a>, field name in the database is "event_date".</p>
  
  <p>I've tried the following in various forms:</p>
  
  <pre><code>$args = array(
       'post_status'       =&gt; 'publish',
       'meta_key'          =&gt; 'event_date',
       'orderby'           =&gt; 'meta_value_num',
       'order'             =&gt; 'DESC',
       'posts_per_page'    =&gt; 6,
       'paged'             =&gt; $paged,
       'post__not_in'      =&gt; $exclude_array
  );
  
  $temp = $wp_query;
  $wp_query = null;
  $wp_query = new WP_Query($args);
  
  $default_excerpt_length = 250;
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>$args = array(
      'post_status'       =&gt; 'publish',
      'meta_key'          =&gt; 'event_date',
      'meta_value_num'    =&gt; time(),
      'meta_compare'      =&gt; '&gt;=',
      'orderby'           =&gt; 'meta_value_num',
      'order'             =&gt; 'DESC',
      'posts_per_page'    =&gt; 6,
      'paged'             =&gt; $paged,
      'post__not_in'      =&gt; $exclude_array
  );
  
  $temp = $wp_query;
  $wp_query = null;
  $wp_query = new WP_Query($args);
  
  $default_excerpt_length = 250;
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>$today = date('Y-m-d');
  
  query_posts(array(
      'post_type'         =&gt; 'events',
      'posts_per_page'    =&gt; 6,
      'paged'             =&gt; $paged,
      'meta_key'          =&gt; 'event_date',
      'orderby'           =&gt; 'meta_value',
      'order'             =&gt; 'DESC',
      'meta_query' =&gt; array(
          array(
          'key'        =&gt; 'event_date',
          'meta-value' =&gt; $value,
          'value'      =&gt; $today,
          'compare'    =&gt; '&gt;=',
          'type'       =&gt; 'CHAR'
          )
      )
  ));
  </code></pre>