I am trying to update a post_object field with multiple values turned on, and I am getting no response.
$post_id = 1361;
$user_id = 7;
$name_field = 'my_post_object_name';
update_field( $name_field, $post_id , "user_" . $user_id);
I have also tried passing in the posts as an array that did not work.
$posts = array();
array_push($posts, $post_id);
update_field( $name_field, $posts, "user_" . $user_id);
I am not finding any official documentation on this, are there any code examples of this anywhere? thank you
I’m not sure what you are attempting to do.
Are you trying to add a post to a relationship that already exists?
What exactly is not working?
What do you expect to happen?
What is happening?
Hi This can be closed, I talked to support and confirmed it wasn’t ACF it was another part of the application causing the issue which made it seem like saving multiple values to a ACF post_object wasn’t working while other ACF stuff was working. There is documentation on updating multiple posts in a post_object but it’s just on a different section of the website. The code was working as long as an array of IDs was passed in. Thank you