I’m creating a zipper code radius search. I’m pulling the all of the zip codes inside a radius relying on the search time period via an API, then doing a consumer question to match a customized meta discipline that has their zip and show these customers if there’s a match inside the array of zip codes. I’m doing this for each US/Canada. That is working besides once I improve the radius and if that location occurs to have a considerable amount of zip codes it breaks and no customers are discovered. Particularly in Canada there are actually 1000’s of zip code variations inside only a 10km radius. For instance in case you look right here https://www.freemaptools.com/find-canada-postcodes-inside-radius.htm and search T5T 3E9 there are over 10k zip code outcomes.
This solely appears to be associated to having a really giant array. Any ideas?
curl_setopt($ch, CURLOPT_URL, "https://app.zipcodebase.com/api/v1/radius?" .
http_build_query($information));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"apikey: ", ));
$zipresponse = curl_exec($ch);
curl_close($ch);
$json = json_decode($zipresponse);
$resultArray = json_decode($zipresponse, true);
$zipCodd = $resultArray['results'];
$newzipArray = array();
if ( !empty( $zipCodd ) ) {
$i = 0;
foreach($zipCodd as $information){
$i++;
$newzipArray[$i] = str_replace(' ', '', $information['code']);
}
}
$user_search_args = array (
'quantity' => 50, // What number of per customers
'function' => 'subscriber',
's' => '*' . esc_attr( $search_term ) . '*',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => array('mepr-address-zip', 'mepr_second_location_zip_2','mepr_third_location_zip_3'),
'worth' => $newzipArray,
'evaluate' => 'IN'
),
)
);
$user_search_query = new WP_User_Query( $user_search_args );