Home › Forums › ACF PRO › Change the label for User Field › Reply To: Change the label for User Field
Here is an example for getting the E-mail (First name Last name) in the select user field.
function alter_specific_user_field($result, $user, $field, $post_id) {
$result = $user->user_email;
if( $user->first_name ) {
$result .= ' (' . $user->first_name;
if( $user->last_name ) {
$result .= ' ' . $user->last_name;
}
$result .= ')';
}
return $result;
}
add_filter("acf/fields/user/result/key={field key here}", 'alter_specific_user_field', 10, 4);
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.