FacetWP – Layout Builder – display “User Profile Picture”

<?php

/**
 * This pulls the avatar (profile photo) from the "User Profile Picture" plugin
 * Add a layout builder item (named "avatar") and using the data source of "User ID"
 */
add_filter( 'facetwp_builder_item_value', function( $value, $item ) {
    if ( 'avatar' == $item['settings']['name'] ) {
        $value = get_avatar( $value );
    }
    return $value;
}, 10, 2 );