Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ben Huson

    (@husobj)

    Currently there’s no WP Geo function to save the data so you’ll have to manually add the correct post meta entries yourself. If you just need to save longitude and latitude you can hook into the save_post action and set the current meta:

    update_post_meta( $post_id, WPGEO_LATITUDE_META, {insert latitude value} );
    update_post_meta( $post_id, WPGEO_LONGITUDE_META, {insert longitude value} );

    Note: The save_post action is triggered whenever you save or update a post so you’ll want to do some checks to test your saving the right custom post type and wether the values need updating.

    Thread Starter codecowboy

    (@codecowboy)

    Thanks. I actually need to geocode a postcode, though. Does your code do that somewhere?

    Plugin Author Ben Huson

    (@husobj)

    It doesn’t at the moment but I plan to add it as I’m currently doing something similar for another project. In the meantime you may be able to code something yourself uses Googles Geocoding API:

    https://developers.google.com/maps/documentation/geocoding/#GeocodingRequests

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is there a hook available for custom post types?’ is closed to new replies.