Support

Account

Home Forums General Issues User field type Reply To: User field type

  • Jeremy was on the right track for the simplest solution, but had a couple typos.

    FIXED code to get user ID:

    $select_staff = get_sub_field('select_staff');
    $select_staff_id = $select_staff['ID'];

    The User Relation field returns an array of data. Using get_sub_field* instead of the_sub_field* stores that array into the variable $select_staff.

    Then in order to retrieve the user ID, query the $select_staff array. Note the use of brackets for the array rather than the previous typo with parentheses.