1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
// Save ACF Data from Frontend after created a Venue add_action( 'transition_post_status', 'acf_to_venue', 10, 3 ); function acf_to_venue( $new, $old, $post ) { $event_host = ''; $host_email = ''; if(isset($_POST['community-event'])){ $event_host = $_POST['hostname']; $host_email = $_POST['hostemail']; if ( ( $new == 'pending' ) && ( $old != 'pending' ) && ( $post->post_type == 'tribe_events' ) ) { $post_id = $post->ID; if(!empty($event_host)){ $host_key = "field_599e018622229"; update_field( $host_key, $event_host, $post_id ); } if(!empty($host_email)){ $host_email_key = "field_599ddd2e5951c"; update_field( $host_email_key, $host_email, $post_id ); } } else { return; } } } |