Title: Sort query_posts by date..
Last modified: August 20, 2016

---

# Sort query_posts by date..

 *  [jakus](https://wordpress.org/support/users/jakus/)
 * (@jakus)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/sort-query_posts-by-date/)
 * Yow,
 * I am currently trying to display calendar entry posts in a sidebar, sorting by
   most recent date to least recent.. the code I am using (that I have somewhat 
   inherited) is displayed below:-
 * _[[code moderated ](http://codex.wordpress.org/Forum_Welcome#Posting_Code)– please
   use the [pastebin ](http://pastebin.com/)for any code longer than 10 lines]_
 * for some reason this query seems to totally ignore any order or orderby commands
   i give and only displays the sidebar entries by date created, not date specified.
 * if anyone could provide assistance, it would be greatly appreciated.
 * cheers.

Viewing 1 replies (of 1 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/sort-query_posts-by-date/#post-2453893)
 * [http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters)
 * > ‘meta_value’ – Note that a ‘meta_key=keyname’ must also be present in the query.
   > Note also that the sorting will be alphabetical which is fine for strings (
   > i.e. words), but can be unexpected for numbers (e.g. 1, 3, 34, 4, 56, 6, etc,
   > rather than 1, 3, 4, 6, 34, 56 as you might naturally expect).
   >  ‘meta_value_num’–
   > Order by numeric meta value (available with Version 2.8). Also note that a ‘
   > meta_key=keyname’ must also be present in the query. This value allows for 
   > numerical sorting as noted above in ‘meta_value’.

Viewing 1 replies (of 1 total)

The topic ‘Sort query_posts by date..’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/sort-query_posts-by-date/#post-2453893)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
