Change Maps API Geocode values

If you run into the situation on the add listing page where the maps API is returning a wrong or unwanted value you can alter it.

In the below code snippet example the region is returning "East Lothian Council" however the area is better know as just "East Lothian" so we set the  getState variable to alter it.

You can use the Code Snippets plugin to add this to your site: 

function _my_add_listing_geocode_fix() {
if(getState == "East Lothian Council"){ getState = "East Lothian";}
add_action( 'geodir_add_listing_geocode_js_vars', '_my_add_listing_geocode_fix' );

Other variables that can be adjusted are:

getAddress, getZip, getCity, getState, getCountry, getAddress2, baseCountry
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us