Update when post updated WPUF
-
Hello, how are you?
I am using the code below to integrate GEO my WP with the WP User Frontend plugin.
When a new post is created it works very well. But when editing the post the address does not update automatically. In the field of WPUF it is updated, but in the field of GEO my WP, the first registered address always remains.
Can you help me with that?
=======
CODEfunction gmw_update_location_via_wpuf( $post_id ) {
// make sure post ID exists.
if ( ! $post_id ) {
return;
}// verify updater function.
if ( function_exists( ‘gmw_update_post_location’ ) ) {// change meta_field_name to the custom field of the address field.
$address = get_post_meta( $post_id, ‘cf_address’, true );//run geocoder function
gmw_update_post_location( $post_id, $address );
}
}
//update data of new post
add_action(‘wpuf_add_post_after_insert’, ‘gmw_update_location_via_wpuf’, 10, 1 );
//update data when post updated
add_action(‘wpuf_add_post_after_updated’, ‘gmw_update_location_via_wpuf’, 10, 1 );
- The topic ‘Update when post updated WPUF’ is closed to new replies.