Title: Sorting posts using dates coming from Custom Fields
Last modified: August 19, 2016

---

# Sorting posts using dates coming from Custom Fields

 *  [Icethrill](https://wordpress.org/support/users/icethrill/)
 * (@icethrill)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/sorting-posts-using-dates-coming-from-custom-fields/)
 * I am trying to sort a post loop using custom fields using the Y-m-d setup. So
   I want a post using 2010-12-22 to come before an 2011-01-06. But using my query
   below I dont get that functionality. Can someone help me?
 *     ```
       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
   
               $args = array(
       		'post_type' => array('news'),
       		'posts_per_page' => 10,
       		'meta_key' => 'cft_startdate',
       		'meta_compare' => '>=',
       		'meta_value' => date("Y-m-d"),
       		'order_by' => 'meta_value',
       		'order' => 'ASC',
       		'paged' => $paged
       	);
       	$query = query_posts($args);
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [Icethrill](https://wordpress.org/support/users/icethrill/)
 * (@icethrill)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/sorting-posts-using-dates-coming-from-custom-fields/#post-1808591)
 * Anyone who can help me on this one?

Viewing 1 replies (of 1 total)

The topic ‘Sorting posts using dates coming from Custom Fields’ is closed to new
replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [Icethrill](https://wordpress.org/support/users/icethrill/)
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/sorting-posts-using-dates-coming-from-custom-fields/#post-1808591)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
