How to output custom post type title on custom page with category next to it?
$leaderQuery->the_post() should only be called once, right after the loop starts: while ( $leaderQuery->have_posts() ) { $leaderQuery->the_post(); // call it just once … } I could also see you’re not correctly retrieving the ID of the current post in the loop, so the correct way is use get_the_ID(). $postCategories = get_the_category( get_the_ID() ); // like … Read more