Title: Ordering posts by numerical custom field
Last modified: August 21, 2016

---

# Ordering posts by numerical custom field

 *  [Swennet](https://wordpress.org/support/users/swennet/)
 * (@swennet)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/ordering-posts-by-numerical-custom-field/)
 * I’m trying to order my posts by using the following code added to my url:
 * `?meta_key=length&orderby=meta_value_num&order=desc`
 * However, it doesn’t seem to actually order my posts by the numerical value of‘
   length’.
 * Why does it not work?

Viewing 1 replies (of 1 total)

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/ordering-posts-by-numerical-custom-field/#post-3645563)
 * Try it with “orderby=meta_value_num”
    [http://codex.wordpress.org/Function_Reference/WP_Query#Order_.26_Orderby_Parameters](http://codex.wordpress.org/Function_Reference/WP_Query#Order_.26_Orderby_Parameters)

Viewing 1 replies (of 1 total)

The topic ‘Ordering posts by numerical custom field’ is closed to new replies.

## Tags

 * [meta_key](https://wordpress.org/support/topic-tag/meta_key/)
 * [meta_value)](https://wordpress.org/support/topic-tag/meta_value/)
 * [meta_value_num](https://wordpress.org/support/topic-tag/meta_value_num/)
 * [orderby](https://wordpress.org/support/topic-tag/orderby/)
 * [query](https://wordpress.org/support/topic-tag/query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/ordering-posts-by-numerical-custom-field/#post-3645563)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
