How To List All Authors under a CPT

I’m working on a Custom Post Type that has a bunch of members/authors that are not registered as wp-users.

For every post that is published under my_custom_post_type, the authors’ name is print out.

$curauth = (isset($_GET[‘author_name’])) ? get_user_by(‘slug’, $author_name)
: get_userdata(intval($author));

$args = array(
‘post_type’ => ‘my_custom_post_type’,
‘posts_per_page’ => – 1,
‘author’ => $curauth->ID
);

$loop = new WP_Query($args);

if($loop->have_posts()) {
while($loop->have_posts()) {
$loop->the_post();

$ctp_author = get_post_meta(get_the_ID(), ‘ctp_author’, true);
echo $ctp_author;
}
}

Now I would like to loop over and print a list of all authors that have published posts under my_custom_post_type.

Is there a quick way to do this? Remember that these authors are not registered as wordpress users.

Read more here:: How To List All Authors under a CPT

Leave a Reply

Your email address will not be published. Required fields are marked *