AIサマリー
説明
について wpforms_frontend_output_success アクションはフォーム送信の直後にトリガーされます。
パラメータ
- フォームデータ
- (配列) 処理済みのフォーム設定/データ。
- フィールド
- (配列) サニタイズされたエントリーフィールドの値/プロパティ。
- $entry_id
- (int) エントリーID。
ソース
wpforms/src/Frontend/Frontend.php
詳細情報
このアクションは、フォームが送信された直後、エントリーを保存してEメール通知を送信する前に実行されます。
例
この例では、フォームが送信された後、確認メッセージのすぐ上に表示されますが、各フォームフィールドに入力された値も表示されます。
/*
* Action fires immediately after the form submission
*
* @link https://wpforms.com/developers/wpforms_frontend_output_success/
*
* @param array $form_data Form data and settings.
* @param array $fields Sanitized entry field. values/properties.
* @param int $entry_id Entry ID.
*/
function wpf_dev_frontend_output_success( $form_data, $fields, $entry_id ) {
// Reset the form settings
unset(
$_GET[ 'wpforms_return' ],
$_POST[ 'wpforms' ][ 'id' ]
);
// Uncomment this line out if you want to clear the form field values after submission
unset( $_POST[ 'wpforms' ][ 'fields' ] );
// Actually render the form.
wpforms()->frontend->output( $form_data[ 'id' ] );
}
add_action( 'wpforms_frontend_output_success', 'wpf_dev_frontend_output_success', 10, 3 );