Title: Sorting posts, per category, by priority
Last modified: August 19, 2016

---

# Sorting posts, per category, by priority

 *  Resolved [Daffydd57](https://wordpress.org/support/users/daffydd57/)
 * (@daffydd57)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/sorting-posts-per-category-by-priority/)
 * Hi all,
 * Would like to use the WordPress admin as a news updater – pushing the stories
   to my website. I would like to be able- throught custom field? – to give a post
   a priority number so that the posts will fall onto the homepage in the order 
   we want them to.
 * Can this be done? I would appreciate any info on this. I know nothing about coding
   php or MySQL so details would be great! 🙂
 * Thanks so much!
    Daf

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [Daffydd57](https://wordpress.org/support/users/daffydd57/)
 * (@daffydd57)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/sorting-posts-per-category-by-priority/#post-1304338)
 * Okay – I’m making some headway here.
 * I’m thinking that I can use the custom fields – set to “Priority” and set the
   value (1 through 9) per post.
 * Then – and this is where I get a bit lost – I can use the
 * `query_posts('meta_key=priority&meta_value=1');`
 * or use the `meta_compare` – I’m not sure…
 * I could then, if I am not mistaken, push all the posts with the “1” value to 
   the homepage. That is part of the solution.
 * What I want to do, and don’t know how to modify the query_posts statement – is
   display the posts ranked by meta_key value. So that all the “1” posts are first,
   then followed by “2”, etc…
 * So little help with that code would be greatly appreciated! 🙂
 * Thanks!
 *  [xdesi](https://wordpress.org/support/users/xdesi/)
 * (@xdesi)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/sorting-posts-per-category-by-priority/#post-1304341)
 * Does:
 * `query_posts('meta_key=priority&orderby=meta_value&order=ASC');`
 * Work?
 *  Thread Starter [Daffydd57](https://wordpress.org/support/users/daffydd57/)
 * (@daffydd57)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/sorting-posts-per-category-by-priority/#post-1304483)
 * xdesi – it does appear to be doing what I want!!! Thanks so much!
 *  [xdesi](https://wordpress.org/support/users/xdesi/)
 * (@xdesi)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/sorting-posts-per-category-by-priority/#post-1304488)
 * Nice one 🙂
 *  Thread Starter [Daffydd57](https://wordpress.org/support/users/daffydd57/)
 * (@daffydd57)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/sorting-posts-per-category-by-priority/#post-1304844)
 * Okay – let’s try to take this a step further if possible. The above system is
   working perfectly – but I would like for each new post to have a default meta_key–
   meta_value of 5 for the priority custom field.
 * So that when bringing up the new post dialog the custom field is already set 
   to “priority” and the value is set to “5”
 * Asking too much? 🙂
 * Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Sorting posts, per category, by priority’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [priority](https://wordpress.org/support/topic-tag/priority/)
 * [sort](https://wordpress.org/support/topic-tag/sort/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Daffydd57](https://wordpress.org/support/users/daffydd57/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/sorting-posts-per-category-by-priority/#post-1304844)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
