Home › Forums › ACF PRO › Prefill for acf_form? › Reply To: Prefill for acf_form?
add_filter('acf/load_value/key=field_12345', 'load_my_field_12345', 20, 3);
function load_my_field_12345($value, $post_id, $field) {
// check for empty value
if ($value !== NULL) {
// you may need to check for something else specific to this field type
// but not being empty indicates a value was already set for this post
// so bail
return $value;
}
$value = "whatever value is appropriate for this field type":
return $value;
}
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.