Home Forums ACF PRO User Relationship Field – Get User ID Reply To: User Relationship Field – Get User ID

  • Pretty straight forward, heres how I usually do it.

    			$username = get_field('your_user_field_name'); // this gives us an array of all user data.. 		
    			$userID = $username['ID'];   // grabs the user ID
    			// this could be a custom ACF field you added to the user screen
    			$jobtitle = get_field('custom_user_field', 'user_'. $userID );			
    			// grabs corresponding social info from user account
    			$theemail = get_the_author_meta('user_email', $userID); 
    			$linkedin = get_the_author_meta('linkedin', $userID); 
    			$twitter = get_the_author_meta('twitter', $userID); 
    			$gplus = get_the_author_meta('googleplus', $userID); 

    You can look up get_the_author_meta for all of the other options available as well.

    Edit: some screenshots.. This assumes you are using the actual “User” field type from ACF.