I've read a lot, tried a lot more, but can't get what I want: I have custom post types, which I want to order in DESC, orderby its meta value:
The complete query with its arguments:
wp_reset_query(); $args = array( 'meta_key' => 'completeness', 'order_by' => 'meta_value_num', 'posts_per_page' => -1, 'order' => 'DESC', 'post_type' => 'datensatz', 'post_status' => 'draft' ); $the_query = new WP_Query( $args ); if ( $the_query -> have_posts() ): while ( $the_query -> have_posts()) : $the_query -> the_post(); global $post; echo get_the_title().':'.get_post_meta( $post->ID, "completeness", TRUE ).'<br/>'; endwhile; endif; wp_reset_query();
This query does not work. Any help would be greatly appreciated.
I have just had a look at the last db query by
$wpdb->last_query and got this:
"SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (206,200,199,198,197,[..]) ORDER BY meta_id ASC"
So my WP query MUST be wrong...