It all depends on how you’re trying to do it. When it comes to filtering results, i usually setup the form to use $_GET and filter the results when the page loads again:
if (isset($_GET['term'])) {
$term = $_GET['term'];
} else {
$term = 'defaultTerm';
}
if (isset($_GET['childterm'])) {
$childterm = $_GET['childterm'];
} else {
$childterm = 'defaultChild';
}
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'state',
'field' => 'slug',
'terms' => array( $term, $childterm ),
'operator' => 'IN'
)
)
);
Related Posts:
- orphaned taxonomy terms remove by sql query
- Exclude posts with taxonomy term from appearing on home page query
- How can I query all post with currrent taxonomy term?
- Retrieve all term IDs of post
- How to filter the terms to a special custom taxonomy?
- How to show a hierarchical terms list?
- tax_query in get_posts() not working?
- What is wp_insert_term “alias_of” arg for?
- Automatically Assign Parent Terms When A Child Term is Selected
- get term by id without taxonomy
- Modify Term Update Redirection
- List Hierarchical Term List with Count with Related Term
- Is there a way to set singular/plural labels for taxonomy term names?
- get_terms with posts that have a different taxonomy with term x
- Get_term_by only returns one item from array
- How to find objects by terms
- Can we have same term slug in different taxonomies?
- Is there any difference between post in child term and child & parent terms?
- Create and move terms for taxonomies
- Display Post by taxonomy and taxonomy child
- Missing term_id and term_taxonomy_id when adding a term using wp_insert_term() function
- Count posts for each taxonomy term for each month
- What hooks/filters are there to alter selected terms on post save?
- How can I remove links from the function “get term list”?
- Get Term names from WP Term Object
- tax_query: What to pass when I want to have all terms?
- Add a term to an attachment submitted from front end
- taxonomy/category term in URL slug irrelevant for post?
- How to use a Term Meta Field as a link
- what tables uses wp_get_post_terms
- WordPress built-in method to extract array of term IDs?
- Show only, when taxonomy has posts?
- Pass array of taxonomy terms to wp_query
- Should I be using custom post types for this or terms and taxonomies?
- get_terms problem : related articles
- Custom WP Query: force entry for some taxonomy and have others optional
- Set post terms on post publish
- Why “Warning: Invalid argument supplied for foreach()”
- WordPress User Taxonomy Saved Values
- get_the_terms error
- How can I find the taxonomy in edited_{taxonomy}?
- Set multiple Post Terms in same Taxonomy
- How to get the top level parent term Advanced Custom Field values in the child terms
- Modify the query method when adding category filtering function to the custom post list
- Allow a Taxonomy Term to be Used Only Once Across All Posts
- Count Published & Draft Posts Associated With Each Term
- Show child terms of current term of the taxonomy
- get_the_term_list – Return links to edit.php instead of link to taxonomy archive template
- How to sync to custom taxonomies (tag structure)
- Comma separated tax terms, with “and” before last item [duplicate]
- the_terms characters not limiting
- Hierarchical list of custom taxonomy terms
- Add text to the end of each list item in wp_list_categories
- Syntax help needed: Taxonomy Query
- How to return newly added terms when using wp_set_object_terms
- Blogroll links sorted by category in a table
- How to update a taxonomy term for a custom post type with auto incrementing number
- How to relate a user object to taxonomy term?
- How to display taxonomy term custom meta (using wp_get_object_terms?)?
- SQL query joining on taxonomy tables not returning what I would expect
- Echo taxonomy name – second level
- Match and Merge Terms in Different Taxonomies
- Get terms in hierarchical taxonomy
- Taxonomy Checkbox Admin Panel
- Related terms – Terms that feature in post of current term
- How to order a taxonomy’s terms numerically, from lowest to highest using get_terms
- update_term_meta not working
- Assign Multiple Values from Post Fields to Taxonomy Terms
- Query Two Different Taxonomies Nested
- wp_insert_term doesn’t want to enter its data into custom taxonomy
- Checking if a product ID has taxonomy term attached not working with has_term
- Taxonomy.php inheriting first post
- What is the use case for sharing a term between multiple taxonomies?
- Order custom taxonomy hierarchy
- Including taxonomy in searches
- I want to get term by term_name without taxonomy
- I want to change the slugs of my terms dynamically
- What is this Query? and why its taking too much time? Any way to optimize it?
- taxonomy terms, inverted
- taxonomy_edit_form_fields output after term fields
- Create multidimensional array of taxonomies
- How to show terms from another taxonomy
- How to share terms between two taxonomies?
- $product->ID in has_term() not working, but manually inputting the ID works, why?
- Can I have have terms with the same slug in the same taxonomy?
- how do you get one specific term from a shortcode attribute?
- Taxonomy terms can’t find posts from archive.php or taxonomy.php
- What is the earliest hook you can piggyback on to check terms/taxonomy for a collection view?
- No results for taxonomy archive page
- How to get a query odered by N of matching taxonomies?
- 2 Different Taxonomy with Hierarchical Term Relationship
- GET Taxonomy ID
- Displaying Results From Custom Taxonomy Query
- Non-Recursive get_term_children()
- Display yesterday’s last post’s Custom field from Unique terms of one Taxonomies
- How do I add tags/taxonomy to images + a query field on page to query ‘albums’ (images with same tag/taxonomy)
- Delete Term via edit-tags.php
- Order taxonomy terms by the frequency of use in the last 30 days
- Why can’t I exclude a term ID from either get_terms or WP_Term_query?
- get_terms of specific parent (including the parent itself)