I am using the CPT UI plugin which i have created a custom post type with (called Knowledgebase and the taxonomy called knowledgebase-categories)
i am using this code to display posts:
<?php $query = new WP_Query( array('post_type' => 'knowledgebase', 'posts_per_page' => 20, 'category_name' => 'Cisco' ) ); ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href=""><?php the_title(); ?></a>
</article> <!-- .et_pb_post -->
<?php endwhile; ?>
it works fine without the category_name
but with the above code its not showing any posts
there are posts with a category of Cisco
May this will Help you
Here you can achieve by this
because they are posts from a custom post type i had to change
category_name
to the taxonomy (which is knowledgebase-categories)