Reset Regions

Hi! I changed from Google Maps API to Mapbox a while back, and it seems they place listings in different regions (places that are actually located in the same regions, but i guess there might be minor changes in spelling etc between the different API-providers).

Is there a way to reset / delete all regions currently saved, so i can generate them again only from Mapbox that i currently use?

Problem at the moment is that some listings in approximately the same regions are placed in “different” regions.

Thanks!

Yes, Mapbox and Google Maps have different place IDs so these may be duplicated if you switched after some listings were already added. Please delete regions in Listings/Regions, and then try running this snippet. Once you add it, please refresh the home page until all the regions are created, then delete this snippet (otherwise it’ll slow down the site):

add_action(
	'template_redirect',
	function() {
		if(hivepress()->get_version('geolocation')){
			$listing_ids = HivePress\Models\Listing::query()->order('random')->limit(50)->get_ids();
			foreach ($listing_ids as $listing_id){
				do_action( 'hivepress/v1/models/listing/update_longitude', $listing_id );	
			}	
		}
	},
	1000
);

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.