Skip to content

Instantly share code, notes, and snippets.

@ash-f
Last active October 12, 2021 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ash-f/4b6678ee992f5d040f749481fd46b3ce to your computer and use it in GitHub Desktop.
Save ash-f/4b6678ee992f5d040f749481fd46b3ce to your computer and use it in GitHub Desktop.
WP Fluent Forms checkbox key-value swapping filter
add_filter('fluentform_response_render_input_checkbox', function ($value, $field, $formId, $isHtml) {
if ( $formId === 3 ) {
$value='';
foreach ( $field['raw']['settings']['advanced_options'] as $fv ) {
$value .= '<li>' . $fv['value'] . '</li>';
}
if( $value !== '' ){
$value = '<ul style="white-space: normal;">' . $value . '</ul>';
}
}
return $value;
}, 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment