Home › Forums › Backend Issues (wp-admin) › acf/load_field does not populate a Post Object field's value › Reply To: acf/load_field does not populate a Post Object field's value
– WordPress 5.4.2
– ACF 5.8.12
– PHP 7.3.15
I’m trying to set a default value for a PostObject field. I can set the value just fine, but I can’t detect whether the field is filled out yet, because the acf/load_field
hook doesn’t populate $field['value']
on this kind of field.
function themename_default_tracking_campaign($field) {
if(empty($field['value'])) { // $field['value'] is always NULL, even if set
$field['value'] = ['3956']; // This line always blows away the set value
}
return $field;
}
add_filter('acf/load_field/name=pardot_tracking_campaign', 'themename_default_tracking_campaign', 99999999);
I think this is just a plain old bug? In any case, I’d love to know a workaround.
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.