{"id":1001,"date":"2025-03-24T14:28:14","date_gmt":"2025-03-24T14:28:14","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/change-maps-api-geocode-values\/"},"modified":"2025-04-03T15:24:36","modified_gmt":"2025-04-03T14:24:36","slug":"change-maps-api-geocode-values","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/code-snippets\/change-maps-api-geocode-values\/","title":{"rendered":"Change Maps API Geocode values"},"content":{"rendered":"\n<p>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.<\/p>\n\n\n\n<p>In the below code snippet example the region is returning &#8220;East Lothian Council&#8221; however the area is better know as just &#8220;East Lothian&#8221; so we set the&nbsp; <strong>getState<\/strong><strong>&nbsp;<\/strong>variable to alter it.<\/p>\n\n\n\n<p>You can use the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\">Code Snippets plugin<\/a> to add this to your site:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">function _my_add_listing_geocode_fix() {\n?&gt;\nif(getState == &quot;East Lothian Council&quot;){ getState = &quot;East Lothian&quot;;}\n&lt;?php\n}\nadd_action( &#039;geodir_add_listing_geocode_js_vars&#039;, &#039;_my_add_listing_geocode_fix&#039; );<\/code><\/pre>\n\n\n\n<p>Other variables that can be adjusted are:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getAddress, getZip, getCity, getState, getCountry, getAddress2, baseCountry<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8220;East Lothian Council&#8221; however the area is better know as just &#8220;East Lothian&#8221; so we set the&nbsp; getState&nbsp;variable to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,433],"class_list":["post-1001","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-tips-tricks-more","gd_placecategory-code-snippets"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/1001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=1001"}],"version-history":[{"count":0,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/1001\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=1001"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=1001"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=1001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}