Skip to content

Instantly share code, notes, and snippets.

@nkb-bd
Created October 5, 2021 16:15
Show Gist options
  • Select an option

  • Save nkb-bd/4c76a6ecf7f523854cdb4a5e77a0dff1 to your computer and use it in GitHub Desktop.

Select an option

Save nkb-bd/4c76a6ecf7f523854cdb4a5e77a0dff1 to your computer and use it in GitHub Desktop.
Preselect chekbox/radio from get parameter in WP FLuent Forms
<?php
add_filter('fluentform_rendering_field_data_input_checkbox', function ($data, $form) {
{
//change form ID
if ($form->id != 5) {
return $data;
}
//set get param value & match with checkbox value
if (isset($_GET['my_value'])) {
$getData = sanitize_text_field($_GET['my_value']);
$data['attributes']['value'] = [$getData];
}
return $data;
}
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment