0

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.

<?php
       $states = get_terms('state');
       foreach($states as $state) {
            wp_reset_query();
            $args = array('post_type' => 'attorneys',
                'tax_query' => array(
                    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'

0

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.