Capturing form_data for GEO My WP.
-
Hi
I have had success using mapping to copy coordinates to Simple Location postmeta (using coordinates) but am trialling GEO My WP for some extra functionality I’d like to introduce. I believe GEO My WP has a Posts Location function for such integrations. Geo My WP does not store the data under postmeta. My code is not capturing the necessary data.
Running
Post my CF7 Form
Smart Grid for CF7
CF7 Geo Map
GEO My WPIn functions.php (per example in above link).
function gmw_update_post_type_post_location( $post_id ) { // Return if it's a post revision. if ( false !== wp_is_post_revision( $post_id ) ) { return; } // check autosave. if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // check if user can edit post. if ( ! current_user_can( 'edit_post', $post_id ) ) { return; } // get the address from the custom field "address". $address = $form_data['address-my-location']; // verify that address exists. if ( empty( $address ) ) { return; } // verify the updater function. if ( ! function_exists( 'gmw_update_post_location' ) ) { return; } //run the update location function gmw_update_post_location( $post_id, $address ); } //execute the function whenever post type is being updated add_action( 'save_post_post', 'gmw_update_post_type_post_location' );
As a check I have mapped this same info into the Post Content and this works as expected.
Appreciate any assistance you can give.
Cheers
– michael
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Capturing form_data for GEO My WP.’ is closed to new replies.