Support » Fixing WordPress » Order posts by Cat and numerical Custom Fields

  • Resolved bizwoo

    (@bizwoo)


    Hi
    I have been trying to order posts from one category in desc or asc order depending on a numerical value in a custom field.
    I believe that wordpress 3.0 have orderby=meta_value_num implemented which should order post using the values in a custom field by-passing previous problems due to sql considering custom field values as strings and not integers.

    This is the query I am using:
    query_posts(“cat=$current_id&meta_key=rated&orderby=meta_value_num&order=DESC”);
    But I do not get the posts ordered as supposed when using this query.
    Any help?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Order posts by Cat and numerical Custom Fields’ is closed to new replies.