Ordering Post by Meta Key (Not Working)
Had same issue. Have spent like few hours searching for the problem and it turned out to be just a typo: instead of incorrect order_by you should use orderby – without the underscore. So, this should work: $args = array( ‘post_type’ => ‘event’, ‘meta_key’ => ‘events_startdate’, ‘orderby’ => ‘meta_value’, ); $post_query = new WP_Query( $args … Read more