WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] sort by a number field with query_posts

[Resolved] sort by a number field with query_posts

  • Hi,

    I am trying to sort a query by a custom field. The cf is a single cf and it contains numbers.
    For some reason when i try to sort some posts by that number field, it handles the fields as text fields and the order result is wrong.

    Example:
    I have 3 posts with the following numbers in that field
    23000
    1234560
    250000

    The ASC ordered result is:

    1234560
    23000
    250000

    This is inappropriated to my purpose. I need the correct order by number like:

    23000
    250000
    1234560

    Any idea to fix this? Maybe even quick & dirty.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] sort by a number field with query_posts’ is closed to new replies.