Fetching Guest Author Meta | WordPress.org

[ad_1]

Hi Jones 🙂

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);
						?>

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer