WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to sort posts by their custom field value, which is a date in this format:

9 August 2012, 7:18 am

        'orderby'  => 'meta_value', 
        'meta_key' => 'wprss_item_date',
        'order' => 'DESC'

Do I need to do some conversion before that can work?

share|improve this question
up vote 0 down vote accepted

Your date should be stored in descending units, like yyyy-mm-dd hh:mm:ss for MySQL to be able to sort on the field.

See the MySQL docs for Date, Datetime, and Timestamp data types.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.