Support

Account

Home Forums Backend Issues (wp-admin) post_object/query orderby meta_value

Unread

post_object/query orderby meta_value

  • Hi- I’m trying to order a list of post objects by a meta_value of date, but the order seems to be forcing itself to ID (I’ve tried both meta_value and meta_value_num for the orderby arg:

    	$today = date("Y-m-d");
    
    	$args['meta_query'] = array(
    		array(
    
    			'key' => 'date',
    			'value' => $today,
    			'compare' => '>=',
    			'type' => 'DATE'
    		)
    	);
    	$args['orderby'] = 'meta_value_num';
    	$args['order'] = 'ASC';
    	
    	return $args;
    

    but the select list is coming back as:

    <select id="acf-field-featured_event" class="post_object" name="fields[field_53d277027125c]">
    <option value="null">- Select -</option>
    <option value="96">2014-07-31 : TURPIS M   ESSA ODEM Suspendisse et FRULLA OPERTED USUELDOL BASED MOLLE TURPIS MESSA ODEM Suspendisse</option>
    <option value="154">2014-07-29 : Another Event</option>
    <option value="166">2014-07-26 : Past Event now in the Future</option>
    </select>

    Is this a bug or am I doing it wrong?

    Any insight would be great…

    Thanks!
    -Rob

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.