How to get the db table row that has the biggest value in the meta value?
The WP_Query has a feature called meta_query. Using it allows you to either query by value or numeric value: $car = new WP_Query( array( ‘post_type’ => array( ‘cars’ ), ‘meta_key’ => ‘car_number’, ‘orderby’ => ‘meta_value_num’, ‘posts_per_page’ => 1, ‘order’ => ‘DESC’, ‘cache_results’ => true, ) ); $carNr = get_post_meta( $car->ID, ‘car_number’, true ); // Inspect … Read more