My taxonomy name is 'store-category'. When i used 'rewrite' = true or 'rewrite' = array('slug' => 'category') it was giving me a 404 error. When I changed it to 'rewrite' => array('slug' => 'group') the problem just went away!
So, the problem turned out to be a rewrite conflict. WordPress had been looking for my store-categories within ...
I wanted to display the terms with the get_the_term_list function so, since categories & taxonomy have a "similar logic", I replaced the "the_category_list"
add_filter( 'the_category_list', 'ci_theme_the_category_list_remove_parent_categories', 10 );
add_filter( 'get_the_terms', '...
It's actually pretty simple: You'll want to use an OR relation, and use the NOT EXISTS operator for selecting posts that are not assigned to any terms in the specified taxonomy.
$tax_query = array(
'relation' => 'OR',
'taxonomy' => 'location',
'field' => 'name',
'terms' => $location,
I know the question is answered, but if anyone is trying to achieve the same with a raw SQL query, you could try the following:
WHERE ID IN (
FROM wpiw_term_relationships AS TR
INNER JOIN wpiw_term_taxonomy AS TT ON TR.term_taxonomy_id = TT.term_taxonomy_id
INNER JOIN wpiw_terms AS T ON TT....