I have created a section to fetch guest authors name, image(avatar/custom) and bio to fetch below my blog post article, but unfortunately only name is coming accurately, can you please suggest what should I do in order to fetch all accurately. Thanks : ) Here is the code I tried
<?php
global $post;
$post_author_name="";
if (function_exists('sgan_get_guest_author_name')) {
$guest_author_name = sgan_get_guest_author_name($post->ID);
if (!empty($guest_author_name)) {
$post_author_name = $guest_author_name;
}
}
if (empty($post_author_name)) {
$post_author_id = $post->post_author;
$post_author_data = get_userdata($post_author_id);
if ($post_author_data) {
$post_author_name = get_the_author($post_id);
}
}
$author_bio = '';
if (!empty($post_author_id)) {
$author_bio = get_the_author_meta('description', $post_author_id);
}
if (!empty($post_author_name)) {
$author_image_url = get_avatar_url($post_author_id);
?>