Can I update a relationship field of a specific post using the update_field() function? If Yes could you please explain how I would achieve this.
NB: The Post I’m linking to are already inserted and I would like to know how I’m going to link them
Sure, the update_field function can be used to update any postmeta value.
All you need to do is create an array containing the post ID’s you wish to save as the relationship value, and then use the update_field function to save that array ($value) to the post.
The docs will explain what parameters are needed for the function to work.
when i set some posts into a relationship Field with update_field, they will be set only after re-saving the post. why?
Using the Field Key (field_535e34692df42) was the solution!
I am trying to update relationship field and its saving the data but not showing in wp-api until I save them from wp-admin. is there any solution for this?