Support

Account

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.