Title: Sorting posts by custom field
Last modified: August 19, 2016

---

# Sorting posts by custom field

 *  Resolved [nadine00](https://wordpress.org/support/users/nadine00/)
 * (@nadine00)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/sorting-posts-by-custom-field/)
 * Hi,
 * How can I go about sorting posts in a specific category by a custom field? I’ve
   been reading up on these:
    [http://codex.wordpress.org/Template_Tags/query_posts](http://codex.wordpress.org/Template_Tags/query_posts)
   [http://codex.wordpress.org/Function_Reference/WP_Query](http://codex.wordpress.org/Function_Reference/WP_Query)
 * And I gave this method a shot…but no go:
    [http://esdev.net/sort-events-by-date-in-wordpress-using-custom-fields/](http://esdev.net/sort-events-by-date-in-wordpress-using-custom-fields/)
 * I really just want something that works like this:
    `get_posts('numberposts=10&
   orderby=meta_key=event_date&cat='.$cat);`
 * Also this page isn’t the main loop, its a secondary page, and i’m pulling posts
   by get_cat_ID.
 * Suggestions?
 * Thanks!
 * _n

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

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [date](https://wordpress.org/support/topic-tag/date/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [nadine00](https://wordpress.org/support/users/nadine00/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/sorting-posts-by-custom-field/)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
