Home › Forums › Front-end Issues › Front-end form doesnt populate 'value' field anymore › Reply To: Front-end form doesnt populate 'value' field anymore
Still not sure why the values aren’t loading but I solved the issue.
I was also, in conjunction with the code snippet above using the following ‘prepare_field’ hooks:
function my_acf_prepare( $field ) {
/* this was added to fix above */
$field['value'] = htmlspecialchars($_GET["xxx"]);
/* this was always here */
$field['readonly'] = true;
return $field;
}
add_filter('acf/prepare_field/name=zzz', 'my_acf_prepare');
I just added a ‘value’ $field object into the prepare field code above that just assigns a value to the field during the prepare_field action instead of using ‘load_value’ from above in cojunction with the ‘prepare_field’ hook.
Hope this helps someone else.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.