I currently have the following set up:

  • Custom post type called “workshops”
  • Within the workshop post type I have a taxonomy called “workshop-status”
  • Workshop status subsequently has categories for example “past-event”

I have been using the code below to fetch posts within a particular post type:

<?php $loop = new WP_Query( array( 'post_type' => 'workshops', 'posts_per_page' => -1 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

    content here...

<?php endwhile; wp_reset_query(); ?>

My question is: how can I change this to fetch a post from the past-event category within my custom post type, and custom taxonomy?

My aim is to have multiple page templates and target each category individually.

I have tried changing the arrange to target the category alone but this did not work. Cannot find an online resource on how to target all aspects.

Thanks in advance.

Read more here: Getting all posts matching custom post type, taxonomy and category


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: