Order Posts by Closest Numeric Values
One possibility is a direct SQL query similar to the one given here. But I’m not convinced that it would be much more efficient than 2 queries, all handled by WordPress: The is untested $price =0; //Price of current property $id=0; //Property (post) ID. $args = array( ‘post_type’ => ‘property’, ‘post__not_in’=>array($id), ‘posts_per_page’=> 2, ‘meta_query’ => … Read more