ACF Save Post Object

1. The first line is an action hook. It tells WordPress to run the function my_acf_post_object_new_post_action() when the post_object field is saved.

2. The second line is the function that will run when the action hook is triggered.

3. The third line is a comment that explains what the function does.

4. The fourth line is the function itself. It updates the feature field with the title of the newly created post.

5. The fifth line is the end of the function.

6. The sixth line is the end of the action hook.

// Save value to a new post and field

<?php

add_action('acfe/fields/post_object/custom_save/name=feature', 'my_acf_post_object_new_post_action', 10, 4);
function my_acf_post_object_new_post_action($new_post_id, $title, $post_id, $field){
    /**
     * @bool        $new_post_id    Newly created Post ID
     * @string      $title          Post title
     * @bool/string $post_id        Current Post ID
     * @array       $field          Field array
     */
    update_field('feature', $title, $new_post_id);
}