Support

Account

Home Forums ACF PRO Displaying users (relationship field) results in "array" in post Reply To: Displaying users (relationship field) results in "array" in post

  • Hello Nessler,

    The user field allows you to choose three options to return data.

    1. User Array
    2. User Object
    3. User ID

    With the first being the default. You have a few options here to get the data you want.

    Since this is an array, you can do a little digging and use something like this in your template to find the exact fields you want to display:

    <?php var_dump( get_field('coauteurs') ); ?>

    Then once you pick the fields you want, you can do something like this:

    <?php 
    
    // Get the user
    
    $user_data = get_field('coauteurs');
    
    echo $user_dzata['display_name'];
    
    ?>

    Hope this helps.

    Jeff