Support » Fixing WordPress » WP_QUERY ordered by custom field

  • Hi everyone,

    I’m trying to order post by custom field “YEAR” doing this query:

    new WP_Query('cat=5&showposts=-1&meta_key=year&orderby=meta_value&order=ASC');

    unfortunately the order is incorrect. The field is a number field and there are values like 100, 500, 1050.. and so on.

    The output is a little bit uncorrect, like:

    1050 – 100 – 200 – 900 – 400

    I just don’t know what could be the problem, so please help me 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP_QUERY ordered by custom field’ is closed to new replies.