i thought I had my issue fixed but I found out that it isn't.
I have code in the sidebar of my archive template that only displays the parent taxonomy terms as links to take you to the taxonomy template.
The taxonomy template displays the children of the parent taxonomy term that was chosen. I had used the following code to pull the term ID of the page that is on to display in the post listing field for state. But by doing this which I didn't realize pulls in the current city as a state in the corresponding page. I have looked and tried but is there a way to modify the code below to just display parents of the children. This would quickly solve the issue.
$queried_object = get_queried_object(); $taxonomy = $queried_object->location; $parent_terms = get_terms($taxonomy, array('parent' => 0, 'orderby' => 'slug', 'hide_empty' => false)); $term_id = $queried_object->term_id; $state = get_field('state', $parent_terms . '_' . $term_id);