I have a custom meta field that I want to use to sort with query_posts but its not ordering my posts properly since it is a datestamp (i.e. 04/21/2014) and its treating it like a normal text string.

I thought about converting the field using strtotime but that doesn't work.

$args = array(
  'meta_key'      => strtotime('pexpires'),
  'orderby'       => 'meta_value',
  'order'         => 'desc',
  'post_type'     => 'post',
  'showposts'     => '60',
$query = query_posts($args);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.