How to make an author archive only for certain user role and show related CPT

You can display user posts using user’s ID. This code might provide a quick sample on how to do it (I have not tested the code).

$user_id = $_GET['author_id'];
//The Query
query_posts("author={$user_id}");

//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post();
     the_title();
echo "<br>";
     endwhile;

else:
      echo "No Posts!";
endif;

//Reset Query
wp_reset_query();

As for the SEO part you can use many of the WordPress plugins that provide this functionality. Yoast SEO is a good plugin to do this.

Leave a Comment