Check if a post has term inside loop
Since you’re dealing with custom taxonomies, you must mention that custom taxonomy in has_term(). if ( $prr_query->have_posts() ) { while ( $prr_query->have_posts() ) { $prr_query->the_post(); if (has_term(‘proteger’, ‘prr’)) { the_title(); } } } Source