How can I loop at a Specific Taxonomy from a custom post type?


So I am stuck because I want to loop through post from a SPECIFIC taxonomy. So the Taxonomy is “State” and the post type is “Attorneys” . I have a bunch of attorneys that are in Utah so I want to loop through just the attorneys in Utah.

       $states = get_terms('state');
       foreach($states as $state) {
            $args = array('post_type' => 'attorneys',
                'tax_query' => array(
                        'taxonomy' => 'state',
                        'field' => 'slug',
                        'terms' => $state->slug,

The array above is what i am currently using to loop through all the attorneys from all the existing ‘state’ taxonomy. My question is, what would i have to do to tell WordPress, just loop through the ones that belong to the state of ‘utah’

fjimenez 5 months 2022-07-14T13:05:28-05:00 0 Answers 0 views 0

Leave an answer