<?php
/** get a user acf field for the post author
** use as {{ acf:author_title }} in an HTML item in layout builder
**/
add_filter( 'facetwp_builder_dynamic_tag_value', function( $tag_value, $tag_name, $params ) {
if ( 'acf:author_title' == $tag_name ) {
$author = get_post_field( 'post_author', $params['post']->ID );
$tag_value = get_field( 'first_name', 'user_' . $author );
}
return $tag_value;
}, 10, 3 );