Address Geocoder WordPress Plugin


A simple WordPress plugin for saving location data with Posts and Pages. Conveniently converts addresses to lat/lng from the Edit screen.

Storing addresses as lat/lng (rather than geocoding each time a user requests a page) decreases load time. This plug-in makes it easy for content managers to generate lat/lng, which is stored with the post as a custom field that can be accessed as part of the loop.

Uses the Google Maps JavaScript API V.3.

Installation and Usage

  1. Get a copy of the plugin from WordPress.org or Github);
  2. Unzip and upload it to your /plugins directory;
  3. Activate the plugin from the Dashboard;
  4. You should now find a metabox labeled “Geocoder” on your Post and Page Edit screens. Enter an address in the address field (this can be an exact address or the name of a famous place — anything Google will understand);
  5. Press the “Geocode Address” button;
  6. The Lat/Lng field will populate with a lat/lng object and a map will appear in the preview box, with a marker on the location.

Access your data in the loop using the functions get_geocode_latlng() and get_geocode_address(), with the post ID passed as a parameter. Such as:

Lat/Lng:
<?php echo get_geocode_latlng($post->ID); ?>
 
Address:
<?php echo get_geocode_address($post->ID); ?>

That’s it!

Issues and Support

If you need a hand or find a bug, please leave a comment here or, preferably, open a ticket on Github. Thanks!

Posted May 2012

Made under the ☀ in Austin, Texas.
WordPress hosting by WP Engine, thanks y’all!

© 2022 Spellerberg Associates LLC