/** * Send the entry id through webhooks request. * * @link https://wpforms.com/developers/how-to-send-field-values-with-webhooks/ */ function wpf_dev_webhooks_process_delivery_request_options( $options, $webhook_data, $fields, $form_data, $entry_id ) { // Optional, you can limit to specific forms. Below, we restrict output to // form #1899. if ( absint( $form_data[ 'id' ] ) !== 1899 ) { return $options; } $body = ! is_array( $options[ 'body' ] ) ? json_decode( $options[ 'body' ], true ) : $options[ 'body' ]; // Create a new entry and assign the entry_id $body[ 'entry_id' ] = $entry_id; // Format request data. if ( !empty( $options[ 'method' ] ) && $options[ 'method' ] !== 'GET' && $webhook_data[ 'format' ] === 'json' ) { // Encode request body. $options[ 'body' ] = wp_json_encode( $body ); } return $options; } add_filter( 'wpforms_webhooks_process_delivery_request_options', 'wpf_dev_webhooks_process_delivery_request_options', 100, 5);

Category: Uncategorized