get_queried_object(); // Posts args $args = array( 'posts_per_page' => - 1, 'post_type' => 'portfolio', 'tax_query' => array( array( 'taxonomy' => 'portfolio-category', 'field' => 'slug', 'terms' => $tax->slug ) ) ); $portfolioCategory = new WP_Query( $args ); ?>