2 added escaping %'s
source | link

I got curious about the answers above, where the meta_query targeted the key latitude instead of _coordinates. Had to go and test if it really was possible in meta queries to target a specific key inside a serialized array. :)

That obviously wasn't the case.

So, note that the correct key to target is _coordinates instead of latitude.

$args = array(
     'post_type' => 'my-post-type',
     'meta_query' => array(
         array(
             'key' => '_coordinates',
             'value' => sprintf(':"%s";', $value),
             'compare' => 'LIKE'
         )
     )
 );

NOTES:

  1. This approach makes it only possible to target exact matches. So things like all latitudes greater than 50 are not possible.

  2. To include substring matches, one could use 'value' => sprintf(':"%%s%";'"%%%s%%";', $value),. (haven't tested)

I got curious about the answers above, where the meta_query targeted the key latitude instead of _coordinates. Had to go and test if it really was possible in meta queries to target a specific key inside a serialized array. :)

That obviously wasn't the case.

So, note that the correct key to target is _coordinates instead of latitude.

$args = array(
     'post_type' => 'my-post-type',
     'meta_query' => array(
         array(
             'key' => '_coordinates',
             'value' => sprintf(':"%s";', $value),
             'compare' => 'LIKE'
         )
     )
 );

NOTES:

  1. This approach makes it only possible to target exact matches. So things like all latitudes greater than 50 are not possible.

  2. To include substring matches, one could use 'value' => sprintf(':"%%s%";', $value),. (haven't tested)

I got curious about the answers above, where the meta_query targeted the key latitude instead of _coordinates. Had to go and test if it really was possible in meta queries to target a specific key inside a serialized array. :)

That obviously wasn't the case.

So, note that the correct key to target is _coordinates instead of latitude.

$args = array(
     'post_type' => 'my-post-type',
     'meta_query' => array(
         array(
             'key' => '_coordinates',
             'value' => sprintf(':"%s";', $value),
             'compare' => 'LIKE'
         )
     )
 );

NOTES:

  1. This approach makes it only possible to target exact matches. So things like all latitudes greater than 50 are not possible.

  2. To include substring matches, one could use 'value' => sprintf(':"%%%s%%";', $value),. (haven't tested)

1
source | link

I got curious about the answers above, where the meta_query targeted the key latitude instead of _coordinates. Had to go and test if it really was possible in meta queries to target a specific key inside a serialized array. :)

That obviously wasn't the case.

So, note that the correct key to target is _coordinates instead of latitude.

$args = array(
     'post_type' => 'my-post-type',
     'meta_query' => array(
         array(
             'key' => '_coordinates',
             'value' => sprintf(':"%s";', $value),
             'compare' => 'LIKE'
         )
     )
 );

NOTES:

  1. This approach makes it only possible to target exact matches. So things like all latitudes greater than 50 are not possible.

  2. To include substring matches, one could use 'value' => sprintf(':"%%s%";', $value),. (haven't tested)