I have followed the following Google developer doc about creating a store locator usng PHP & MySql.


I have this working but now I would like to integrate this with an existing Wordpress installation.

My problem with integrating this, is the way WP stores repeatable custom fields. I have a repeatable field to enter multiple markers per custom post type. WP stores this as serialised data within the DB.

I cannot see a way of using the Haversine formula select statement mentioned in the doc to perform the radius search based on an entered postcode. I know there are various Google Map plugins out there, but I can't find any that will:

  • Add multiple markers per custom post
  • Provide a search to list markers within a radius of an entered postcode

Has anyone got any suggestions how I can do this, or does these features exist?

Thanks in advance for any help on this.

1 Answer 1


I implemented a similar custom store locator for a client, and what I ended up doing was saving each lat / lon pair as post meta for a single location post type, and then assigning each location post type to a parent store post type. that way, a single store could have multiple unique locations. location posts were hidden in admin and managed via a custom meta box within the store post type.

  • Ok this sounds like an ideal solution. How do I go about assigning a location to a parent and also I cant see away to manage these within a different post type? Any tutorials or help on this? Thanks
    – Rob Fyffe
    Nov 12, 2012 at 10:02
  • @Robert the posts table has a post_parent field you can use to store the ID on save_post. there is no UI for managing a post type within another, I had to create it using add_meta_box, a bit of javascript to manage fields, and the API to insert / update location posts.
    – Milo
    Nov 12, 2012 at 16:01
  • Ok thats great I will give this a shot and let you know how I get on.
    – Rob Fyffe
    Nov 12, 2012 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.