Thanks for the reply! To reproduce, you just need to make a new field and assign that field group to “Attachment”. You will see the fields visible on the Add Media uploader, but when in a post, try editing an image and you will not see the fields on the Edit Image details pop-up
Here is the export code of the field.
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array (
'key' => 'group_57e963afdcfe3',
'title' => 'Photo Fields',
'fields' => array (
array (
'default_value' => '',
'maxlength' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'key' => 'field_582226ff24d7c',
'label' => 'Artist / Photographer',
'name' => 'photographer',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'readonly' => 0,
'disabled' => 0,
),
array (
'default_value' => '',
'placeholder' => '',
'key' => 'field_5822270c24d7d',
'label' => 'URL for Artist / Photographer\'s Website',
'name' => 'photographer_url',
'type' => 'url',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
),
array (
'default_value' => '',
'maxlength' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'key' => 'field_58222aaa2fadb',
'label' => 'Licensor / Distributor',
'name' => 'license',
'type' => 'text',
'instructions' => 'Cite the publishing house or source of image (e.g. Getty, Flickr, MOMA...)',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'readonly' => 0,
'disabled' => 0,
),
array (
'default_value' => '',
'placeholder' => '',
'key' => 'field_5822271f24d7e',
'label' => 'URL for Image Source',
'name' => 'photo_url',
'type' => 'url',
'instructions' => 'Link to the specific page of the image provided.',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
),
array (
'multiple' => 0,
'allow_null' => 1,
'choices' => array (
'None (All Rights Reserved)' => 'None (All Rights Reserved)',
'Some Rights Reserved' => 'Some Rights Reserved',
'Public Domain Work' => 'Public Domain Work',
'Public Domain Dedication (CC0)' => 'Public Domain Dedication (CC0)',
'Attribution' => 'Attribution',
'Attribution-ShareAlike' => 'Attribution-ShareAlike',
'Attribution-NoDerivs' => 'Attribution-NoDerivs',
'Attribution-NonCommercial' => 'Attribution-NonCommercial',
'Attribution-NonCommercial-Sharealike' => 'Attribution-NonCommercial-Sharealike',
'Attribution-NonCommercial-NoDerivs' => 'Attribution-NonCommercial-NoDerivs',
'U.S. Government Work' => 'U.S. Government Work',
'No known copyright restrictions' => 'No known copyright restrictions',
),
'default_value' => array (
),
'ui' => 0,
'ajax' => 0,
'placeholder' => '',
'return_format' => 'value',
'key' => 'field_58222acc2fadc',
'label' => 'License',
'name' => 'image_licenses',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
),
array (
'taxonomy' => 'image-tag',
'field_type' => 'multi_select',
'multiple' => 0,
'allow_null' => 1,
'return_format' => 'id',
'add_term' => 1,
'load_terms' => 0,
'save_terms' => 1,
'key' => 'field_58233eaeb75c2',
'label' => 'Tags',
'name' => 'image_tags',
'type' => 'taxonomy',
'instructions' => 'Provide rich descriptors to help search.',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
),
),
'location' => array (
array (
array (
'param' => 'attachment',
'operator' => '==',
'value' => 'all',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
endif;
Thanks so much for the help! I am getting close but one last question. With this snippet I am able to print the assigned users and display the fields. The only issue is for displaying it only shows one of the user biographies despite the print_r showing the two.
<?php
$users = get_field('guests2');
echo '<pre>'; print_r($users); echo '</pre>'; // Prints out assigned user data
if ($users): ?>
<?php foreach ($users as $user): ?>
<?php setup_postdata($user);
$userID = $user['ID'];
$profile_image = get_field('profile_image', 'user_'. $userID);
$biography = get_field('biography', 'user_'. $userID);
?>
<?php echo $biography; ?> // Only displays first user data rather than all
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
Thanks, this worked perfectly!
Thanks for the quick replies! I am using Version 5.3.3.2 of ACF Pro.
I was confused myself whether or not have_rows() was needed when enabling the multi user functionality of the User Field.
Essentially what my desired functionality is to load multiple usernames on a post and then pull user profile_image and biography taken from their profile fields
This is a User field and I am attempting to select multiple users. But maybe is it necessary instead to create a repeater field with only one user select vs multiple user select without repeater?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.