21 Mar 2021

wp query posts loop from specific custom taxonomy

Here is an example where I have created a custom post type called faq_categories.
in the settings for the custom post type, ensure the following is set to true:

  • Hierarchial
  • Rewrite Hierarchial

<?php

$args = array(
'post_type'=>array('faq', 'faqs'),
'taxonomy' => 'faq_categories',
'faq_categories' => 'patient'
);

query_posts($args);



if ( have_posts() ) : ?>

<!-- do something -->

<?php endif;

wp_reset_query()

?>