Support

Account

Home Forums ACF PRO Save post when ACF field value is updated

Solving

Save post when ACF field value is updated

  • 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;
    }
    ?>

  • I am not the best coder in the world… How can I implement update_field() in my snippet?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.