You would have to add the tax_query parameters depending on if the value is there in the GET parameters.
So it would be something like this,
$args = array(
'post_type' => 'post',
'tax_query' => array( 'relation' => 'AND', ) );
$car = $_GET["car"];
if(!empty($car)){
array_push(
$args['tax_query'],
array(
'taxonomy' => 'pa_my_taxonomy',
'field' => 'name',
'terms' => $car,
)
);
}
Related Posts:
- Retrieve posts by term id custom query
- Display category posts grouped by taxonomy
- restrict_manage_posts not working in 3.3.1
- Filter all queries with a specific taxonomy
- wp_query orderby title and meta key value (WP3.1)
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Taxonomy.php issue with search and filters
- How to List Parent Term Links for Custom Taxonomy With & Without Children?
- Recreating the hierarchy of taxonomies for a dropdown form menu?
- Custom taxonomy query not working with switch_to_blog
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- Print terms with taxonomy and metabox value
- Checkbox onclick filtering on the same page
- A way to query custom taxonomies by name
- get the taxonomies terms associated with users
- Rewrite Rules returning wrong data
- Sorting main query by custom taxonomy slug
- WordPress Custom post query sorting does not work
- List related terms + taxonomies
- Search Query for Multiple Terms In Same Taxonomy
- Exclude taxonomy term from all loops, but having it on widget
- Get list of taxonomies associated with users
- query_posts that have custom taxonomy and limiting what shows based on the taxonomy
- Taxonomy archive template that shows posts from more than one taxonomy
- how to access the $query variable inside taxonomy-xxx.php template file?
- Displaying Posts Attached to Custom Taxonomy Terms
- Update Custom Taxonomy Value for a post based on custom date field
- Get 1st parent category id from post
- How to get the term description in a taxonomy term archive query?
- making an index from custom taxonomies and tags of posts (not hierarchical taxonomy)
- Query Multiple Custom Taxonomies
- Query by multiple custom taxonomies
- WP Query : strange behaviour with multiple no-hierarchical tax
- WordPress search form and search result through ACF field in custom taxonomy
- Query pages by child term
- Can I use multi (sub) levels of relation (AND | OR) on custom query?
- Tax Query not working
- Custom taxonomy – query returns an error
- How to perform a search inside a specific taxonomy category
- Adding a query var to taxonomy term archive – gets redirected to the other taxonomy archive page
- add_query_arg to look up page title
- Can I use $query->set() (in a pre_get_posts() hook) with a custom taxonomy in WP 3?
- How can I query for all values of a custom taxonomies?
- query grandchildren taxonomy terms
- How to modify a taxonomy that’s already registered
- Why is my working Custom Taxonomy not in get_taxonomies array?
- Custom taxonomy listing page when no term set (all terms)
- Custom order of terms for custom taxonomy in admin and website
- RSS Feed for posts containing any term from a taxonomy
- How to enable hierarchical permalinks for hierarchical taxonomies
- Exclude Child Term Posts from Parent Term Archive
- Use custom posts as taxonomy term meta replacement?
- Taxonomies not appearing in columns on dashboard
- Make Custom Taxonomy Category Use Parent Template
- Custom taxonomy template not working
- How to get terms of a custom post type in a loop inside footer.php
- List only first-level children of specific custom taxonomy term
- Sorting Posts Via Custom Taxonomy Values Using Checkboxes?
- get_terms of post->id
- get / list categories and counts filtered by custom taxonomy term
- Refine user taxonomy query based on role
- Get ID and slug from taxonomy object
- List the number of posts for each custom taxonomy and specific custom field value
- Show Two custom Post type and their posts on category page
- wp_insert_post not updating custom taxonomy selected if logged in as a subscriber
- How to overwrite registered taxonomy url from vendor plugin in child theme
- Dynamic loading of Archive content based on custom taxonomy term name
- Get posts by name and taxonomy term
- Checking return with WP Error
- Why is the custom taxonomy archive page redirecting me to a single post? [closed]
- Rewrite URL for taxonomy listing
- Query with relation and one without relation using multiple taxonomies?
- Failure to add term meta
- Filter custom taxonomy archive posts by 2nd custom taxonomy using select dropdown
- How to show all post related taxonomies
- Limit number of posts in wp loop
- Get the taxonomy of the post
- using wp_tag_cloud with custom taxonomy
- Get object for a few selected taxonomies
- Handling Multi-level custom taxonomy hierarchy
- Reverse order of posts in a certain taxonomy archive?
- Using Advanced Custom Fields Relationship Field to select a taxonomy term
- How can i add custom field inside custom post taxonomy?
- Custom Taxonomy Not Saving in Front End Post
- How to list Custom Taxonomy
- Showing relevant categories on custom taxonomy template
- Creating a drop-down and filter button for two custom taxonomies assigned to a custom post type
- custom taxonomies on pages
- Conditional if is single and part of the custom taxonomy
- Link a page from admin to a custom taxonomy
- set_object_terms for custom taxonomy in custom post type – not working
- Get all users attached to a taxonomy
- List active taxonomy terms
- How do you move custom fields to custom taxonomies using WP Queries
- Differentiate Parent & Child of Custom Taxonomy
- Listing all selected terms for custom taxonomies on a post
- Taxonomy Extra Meta [duplicate]
- Custom Taxonomy – Archive for the whole Custom Taxonomy (and not just single term)?
- get_terms() – unexpected ‘=>’ (T_DOUBLE_ARROW) error
- Guest author – URL, base and custom taxonomy – working but unstable