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!
Make sure to register for tomorrow’s special ACF-focused edition of #BuildModeLive. Iain Poulson joins @hellosammunoz & @bgardner for a discussion about ACF’s roadmap and what’s in development. https://t.co/k93h4pYCae
— Advanced Custom Fields (@wp_acf) January 26, 2023
© 2023 Advanced Custom Fields.
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.