Home › Forums › General Issues › User Name Field – Display Name Only › Reply To: User Name Field – Display Name Only
@elliot and if the field to pull the user is a sub field? How would this array? I tried several times, but it returns only the first letter of the field $values = get_sub_field('relationship_user');
This:
$values = get_field('user');
if($values)
{
echo '<ul>';
foreach($values as $value)
{
echo '<li>' . $value['display_name'] . '</li>';
}
echo '</ul>';
}
dont work, return first letter of the field
This code by @demo38 work:
$values = get_field('user');
if($values){
$array = array_values($values);
echo $array[5];
Why?
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.