Add action hook function.
-
how do I add action hook on form submit. In my understanding the code below makes sense but clearly it’s not working which means I’m doing it wrong. Can someone help me out with me?
I want to store data from custom fields to DB on form submit from front-end.this is the code I have on function.php in custom theme folder.
function add_location_info( $form_id, $post_id, $form_settings ){ $fullstreet = $_POST['cf_street_number']. ' ' .$_POST['cf_route']; //enter information into the custom table // $wpdb->insert( $wpdb->prefix . 'places_locator', array( 'post_id' => $post->ID, 'post_type' => $post->post_type, 'post_title' => $post_title, 'post_status' => $_POST['post_status'], 'street' => $fullstreet, 'city' => $_POST['cf_locality'], 'state' => $_POST['cf_administrative_area_level_1'], 'zipcode' => $_POST['cf_postal_code'], 'country' => $_POST['cf_country'], 'lat' => $_POST['cf_lat'], 'long' => $_POST['cf_lng'], ) ); } add_action("wpuf_post_submission", "add_location_info", 10, 3); add_action( 'wpuf_add_post_after_insert', 'wpuf_post_submission' );
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Add action hook function.’ is closed to new replies.