
Hello Team,
Recently we have updated our website to make it secure. But there is issue in which user’s input is not getting in ACF field.
https://www.??????.co.uk/parent-registration-form/?school=Acklam%20Whin%20Primary%20School
That ?school parameter insert data in field, which helps to user to redirect to that particular page.
Field Settings : https://ibb.co/tp7V7ft
function acf_load_school_permission_field_choices( $field ) {
// reset choices
$field['choices'] = array();
$choices = array();
// get the textarea value from options page without any formatting
$choices_arr = get_terms(
array(
'taxonomy' => 'product_cat',
'orderby' => 'slug',
'child_of' => 1664,
'parent' => 1664,
'hide_empty' => 0));
// print_r($choices_arr);
foreach ($choices_arr as $choice) {
array_push($choices, $choice->name);
}
update_field( 'schools_list', 'Steve|two|three' , 49902 );
//print_r($choices);
// explode the value so that each line is a new array piece
// $choices = explode(",", $choices);
// remove any unwanted white space
$choices = array_map('trim', $choices);
// loop through array and add to field 'choices'
if( is_array($choices) ) {
foreach( $choices as $choice ) {
$field['choices'][ $choice ] = $choice;
}
}
// return the field
return $field;
}
add_filter('acf/load_field/name=school_permission', 'acf_load_school_permission_field_choices');
add_filter('acf/load_field/name=school_permission_second', 'acf_load_school_permission_field_choices');
Regards
Rajat Sharma