AI Summary
Description
The wpforms_html_field_name
filter lets you customize or remove the field name before it is added to email messages, entry views, or print views. This is especially useful when you want to hide labels for non-input fields like Content, HTML, Page Break, or Section Divider.
This filter is often used to hide or adjust field labels in entry views, email notifications, or when printing a single entry. It provides full control over how non-input fields are displayed to users and admins.
parameter | type | description |
---|---|---|
$field_name | string | The field name or label value. |
$field | array | Field data and settings. |
$form_data | array | Form ID and settings. |
$context | string | The context in which the field name is being used (for example, email-html , single-print ). |
Source
wpforms\includes\emails\class-emails.php
Example
// Hide Content field labels in print view.
function wpf_hide_content_labels( $field_name, $field, $form_data, $context ) {
if ( $context === 'single-print' && $field['type'] === 'content' ) {
return '';
}
return $field_name;
}
add_filter( 'wpforms_html_field_name', 'wpf_hide_content_labels', 10, 4 );