I believe that your syntax is wrong in the variables you set up in your foreach loop. Because you’re referencing an object and not an array, you need to use this format:
$author_ID = $value->ID
and…
$value->display_name
We also discovered that the foreach loop isn’t necessary, so I’m removing it from the answer.
The other issue is how you’re passing the content. Maybe it’s my lack of experience, but I find it easier to refer to “$content” more often and attach more to that variable as I go. You are trying to connect it throughout the argument, and while it makes it more confusing for me, it also doesn’t work (that’s what’s causing the blank page).
Try this:
function wpb_after_post_content($content){ if (is_single()) {
global $post;
$content .= '<p>CAST</p>' .
'<div id="meta-coauthor"><span class="metacoauteur">';
$actor_obj = get_field('movie_actors', $post->ID);
echo '<pre>';
var_dump($actor_obj);
echo '</pre>';
if($actor_obj) {
$author_ID = $actor_obj->ID;
$author_url = esc_url( get_author_posts_url($author_ID) );
$content .= ' <a href="'.$author_url.'">' . $actor_obj->display_name . '</a>';
};
$content .=' </span>
</div>';
}
return $content;
}
add_filter( "the_content", "wpb_after_post_content", 9999 );
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 100, 50, true );
Let me know if that works for you.
I don’t have Ultimate Member so can’t test that code, but if you get it working in the default WordPress screen, you’re not far.