AI Summary
Description
The wpforms_conditional_logic_core_is_field_id_shown filter controls whether the conditional logic field dropdown in the form builder shows each field’s ID after its label. It’s off by default. When it returns true, every form field option reads like Email (ID #4), the same format the builder uses in the field options header.
This filter is available since WPForms 2.0.5.
| parameter | type | description |
|---|---|---|
$is_shown | bool | Whether to show field IDs in the conditional logic field dropdown. Default false. |
Return: (bool) true to show field IDs after the field labels, false to show labels only.
More Information
Field labels alone can be hard to tell apart in the conditional logic dropdown when several fields share a label or have none. Turning this filter on adds the field ID to each option, so you can match a rule to the right field without leaving the builder.
The setting applies everywhere the conditional logic builder appears: field Smart Logic, notifications, confirmations, payment settings, and marketing and other integration connections. The IDs stay in place when the dropdown rebuilds, for example after you change a field label, add or delete a field, or duplicate a field. The dropdown’s hover text matches the selected option.
Fields without a label keep showing Field #4 with no extra suffix. Options that aren’t form fields, such as the Quiz addon’s grade, personality, and score options, don’t get an ID either. Conditional logic needs a paid license, so the filter has no effect in WPForms Lite. With the filter off, the dropdown looks exactly as it did before WPForms 2.0.5.
Source
wpforms/pro/includes/class-conditional-logic-core.php
Example
This example shows the field ID after each field label in the conditional logic dropdown.
/**
* Show field IDs after field labels in the conditional logic dropdown.
*
* @link https://wpforms.com/developers/wpforms_conditional_logic_core_is_field_id_shown/
*
* @param bool $is_shown Whether to show field IDs. Default false.
*
* @return bool
*/
function wpf_dev_conditional_logic_show_field_ids( $is_shown ) {
return true;
}
add_filter( 'wpforms_conditional_logic_core_is_field_id_shown', 'wpf_dev_conditional_logic_show_field_ids', 10, 1 );