Support

Account

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.