Description
The wpforms_pro_fields_entry_preview_get_field_value_show_empty
filter allows you to hide empty fields inside the Entry Preview. It provides control over whether fields with no value should be displayed or hidden in the preview.
Parameters
- $show
- (bool) (Required) Determines if fields with empty values should be displayed in the Entry Preview. default is
true
- $field
- (array) (Required) Field data.
- $form_data
- (array) (Required) Form data.
Source
wpforms/pro/includes/fields/class-entry-preview.php
More Information
This filter is applied specifically to empty fields in the Entry Preview. It gives you the ability to hide any field, effectively removing it from the preview display. By default, all fields, including empty ones, are shown (default is true
). By returning false
, you can hide empty fields on a per-field basis.
Example
/** * Hide empty form fields in Entry Preview. * * @link https://wpforms.com/developers/wpforms_pro_fields_entry_preview_get_field_value_show_empty * * @param bool $show Whether to show fields with empty values. Default true. * @param array $field Field data. * @param array $form_data Form data. * @return bool */ add_filter( 'wpforms_pro_fields_entry_preview_get_field_value_show_empty', function( $show, $field, $form_data )