AI要約
説明
The wpforms_entry_preview_fields filter lets you modify the fields displayed in the Entry Preview. This can be useful for hiding empty fields or rearranging the preview data before it is displayed. You can use this filter to hide fields without values, adjust labels, or completely remove specific fields from the preview display.
| パラメーター | タイプ | 説明 |
|---|---|---|
$fields | array | Entry preview fields data. Each field includes its ID, label, and value. |
$form_data | array | Form ID. |
ソース
wpforms\src\Pro\Forms\Fields\EntryPreview\Field.php
例
/**
* Hide empty fields in the entry preview.
*/
function wpf_dev_hide_empty_preview( $fields, $form_data ) {
$fields = array_filter( $fields, function( $field ) {
return ! empty( $field['value'] );
});
return $fields;
}
add_filter( 'wpforms_entry_preview_fields', 'wpf_dev_hide_empty_preview', 10, 2 );