For some reason the archives for my custom taxonomy is showing each post 3 times and I can't seem to figure out why.

Here is the page: https://portfolioadviserlink.com/topics/esg/

        $custom_terms =  get_terms('topics');

        foreach($custom_terms as $custom_term) {
            $args = array ('post_type' => 'webinar',
                'tax_query' => array(
                        'taxonomy' => 'topics',
                        'field' => 'slug',
                        'terms' => $tax->slug,

            $loop = new WP_Query($args);
            if($loop->have_posts()) { 
                while($loop->have_posts()) : $loop->the_post();


  • Each of your posts are probably in multiple terms. You'll want to write a single better WP_Query where you get posts from all taxonomy terms without foreach – Unbranded Manchester Jun 5 at 10:40
  • @UnbrandedManchester All the posts are only in one term, any other ideas? – Ibrarr Khan Jun 5 at 11:10
  • where is this $tax->slug defined? did you mean to use $custom_term->slug? – Michael Jun 6 at 2:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.