Hi!
I got this code so that I can map API data into a ACF field. This works but the value is only displayed/saved when I manually save the post in WordPress. It needs to save the post automaticly when the value of the field changes.
<?php
add_filter(‘acf/load_field/key=field_62c5916271406’, ‘addObjectInformationToField’, 5);
function addObjectInformationToField($field)
{
global $post;
$object = Bog::find($post->ID);
if (!empty($object)) {
$field[‘value’] = $object->oppervlakte->perceel->render();
}
return $field;
}
?>
You need to call update_field().
I am not the best coder in the world… How can I implement update_field() in my snippet?