Support

Account

Home Forums General Issues update_field not serializing value on relationship field

Solved

update_field not serializing value on relationship field

  • I am having an issue with using update_field on a relationship field. I have a post that has a user_id relationship field.

    When I update the post using update_field, the user id is stored as a string.
    update_field(‘field_5d3737638274e’, $user_id, $request_id);

    However when I update the post via WP Admin, it saves the user id as a serialized value.

    Presumably the serialized value is the correct way. Does anyone have an idea why the function isn’t saving properly when called via custom php?

  • 
    update_field('field_5d3737638274e', array($user_id), $request_id); 
    
  • That worked, thank you John!

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

The topic ‘update_field not serializing value on relationship field’ is closed to new replies.