function waitlists_em_booking_save( $result, $EM_Booking ){ global $wpdb; if ( $EM_Booking->booking_meta['waitlist'] && ($EM_Booking->booking_status == 6 || $EM_Booking->booking_status == 7) ){ $data = array( 'person_id' => 0 ); $where = array( 'booking_id' => $EM_Booking->booking_id ); $result= $wpdb->update( EM_BOOKINGS_TABLE, $data, $where); } return $result; } add_filter('em_booking_save', 'waitlists_em_booking_save', 100, 2);