cwcfp_radio_checkbox_placeholder_default

The cwcfp_radio_checkbox_placeholder_default filter allows you to set a "checked by default" option on radio buttons and checkbox fields.

The filter returns false by default, however to utilize this feature, simply return true.

add_filter( 'cwcfp_radio_checkbox_placeholder_default', '__return_true' );

The filter has two variables passed to it.

  • $value: This is an array of the field's settings. To access values like the field's ID, you would use $value['field_id'];
  • $repeat: This is the number of times the field has been repeated. This can be useful if you only want the first set of fields to have a default option selected, for example.

In order to have this setting work, you will need to set the Placeholder Text on your field as follows:

  • Radio Button fields: Enter the value from the Select Options setting that you want selected by default in the Placeholder Text setting. In the screenshot below, the Radio Button "Two" will be selected by default.
    92bbcaf249f6aa343f5b16550927f20a.png
  • Checkbox fields: Copy the Field Title into the Placeholder Text setting. If these values match, the checkbox will be checked by default. Checkbox fields only have one checkbox available (i.e. for an "agree to terms" checkbox), however, multiple checkbox fields can be used together to have a customer choose multiple options.