Store city selector values as single meta

When you add the city selector field, you can select now if you want to store the values as simple meta as well.

After that you can use a simple meta query to get the correct posts.

  1. $args = [
  2.     'post_type' => 'post',
  3.     'meta_query' => [
  4.         [
  5.             'key'   => 'meta_key_city',
  6.             'value' => 'A city name',
  7.         ],
  8.     ],
  9. ];
  10. $posts = get_posts($args);