Wp Query : Order by distance lat,lon

This may not be possible using what WP_Query gives you out of the box, it wasn’t designed to do math across multiple parameters for sorting. You can filter via meta_query and provide bounds, and you can order by a single value, you can even order by multiple values, e.g. show all items by their lat, … Read more

meta_query where the meta value is not the post title

I found a solution that works (thanks Steve), hopefully somebody will find this useful in the future $sql = “SELECT p.ID FROM wp_posts AS p WHERE post_parent = $post->ID AND post_type=”post_type” AND ID IN ( SELECT post_id FROM wp_postmeta AS pm WHERE pm.meta_key = ‘my_acf_key’ AND pm.meta_value = p.post_title );”; $idList = $wpdb->get_col( $sql );