Home › Forums › Add-ons › Repeater Field › Select a specific value from an image object in a repeater field › Reply To: Select a specific value from an image object in a repeater field
Hi @eggbeater
I believe you can do it like this:
function example_callback( $avatar, $id_or_email, $size, $default, $alt, $args ) {
$user_image = get_field('user_image_field_name', 'user_1');
$gravatar_url = str_replace('&','&',$args['url']);
$avatar = str_replace($gravatar_url, $user_image['sizes']['thumbnail'] , $avatar);
return $avatar;
}
add_filter( 'get_avatar', 'example_callback', 20, 6 );
Keep in mind that that code is an example for an image field, not a repeater field. Also, please change the “user_1” parameter. This page should give you more idea about it: http://www.advancedcustomfields.com/resources/how-to-get-values-from-a-user/.
I hope this helps.
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.