Having:

                     Named
A - Custom Post Type ====> services_cpt
B - Custom Taxanomy  ====> service_tax
C - Custom Tax Term  ====> personal

I am not able to list (Filter) all Post (services_cpt Custom Post Type) which are are categorized under personal term.

<?php
    $custom_terms = get_terms('service_tax');

    foreach($custom_terms as $custom_term) {
    $args = array('post_type' => 'services_cpt',
    'tax_query' => array(
                            array(
                                    'taxonomy' => 'service_tax',
                                    'field' => 'slug',
                                    'terms' => 'personal'
                                  ),
                        ),
    );

    $loop = new WP_Query($args);
    if($loop->have_posts()) {
        echo '<div class="col-md-4">';
        echo '<a class="item-box" href="'.get_permalink().'">'.get_the_title().'</a>';
        echo '</div>';
        while($loop->have_posts()) : $loop->the_post();
    endwhile;
}
}
?>

can you please take a look at this and let me know what I am doing wrong?

Read more here: Not Able to List CPT Based on Taxonomy Term


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: