0 down vote favorite
I am redoing a google widget wordpress directions with version 3. But while doing it I wanted to not have to have someone enter the latitude and longitude of address and just use a geo-code call off of the address. Now I only want to call the geocode when the wordpress widget is updated but am having a hard time finding out if I can do it. I figure I could just pass the instance through a function before updating like below.
function update($new_instance, $old_instance) {
$coords = gmap_geocode($new_instance[‘address’]);
$instance[‘address_longitude’] = strip_tags(($coords[‘long’]));
return $instance; }
With gmap_geocode function returning the long and lat in a array and then putting the information into an instance saved to display on the widgets front end. Is this capable or should I just run the geocode every time on the front end? I don’t think that would be best.