I’ll take another shot.
The following should modify the main query, such that it will include in its loop any posts that belong to no term of the Edition custom taxonomy.
add_filter('pre_get_posts','better_editions_archive');
function better_editions_archive( $query ) {
if ( $query->is_tax( 'edition' ) && $query->is_main_query() ) {
$terms = get_terms( 'edition', array( 'fields' => 'ids' ) );
$query->set( 'post_type', array( 'post' ) );
$query->set( 'tax_query', array(
'relation' => 'OR',
array(
'taxonomy' => 'edition',
'field' => 'id',
'terms' => $terms,
'operator' => 'NOT IN'
)
) );
}
return $query;
}
Related Posts:
- orderby meta_value breaks taxonomy term archives
- Add terms to a taxonomy archive from within the same taxonomy
- Exclude 2 in 3 terms of A Taxonomy from all Archives
- Using pre_get_posts to rewrite search query to display posts from multiple taxonomies
- pre_get_posts with tax_query causes empty result
- Check if current term is a child of another term
- How to hide custom taxonomy archives same way as hiding custom post types?
- pre_get_posts OR relation between taxonomy and author
- How to pass posts_per_page and paged params query vars to custom taxonomy archive urls?
- Help With issue on pre_get_posts filter in taxonomy
- Page queried instead of a custom taxonomy
- tax_query not working on main query
- Using a different template per Custom Taxonomies for single term archive pages
- How to add custom taxonomy to search
- Search by type posts and taxonomy
- How can I get WP to build a feed based on multiple taxonomy terms
- How do I sort posts by custom taxonomy?
- Creating an Archive using a Custom Taxonomy
- How to obtain the link/URL to the feed of a custom taxonomy?
- Display direct children of the current custom taxonomy in taxonomy.php template
- Date archive permalinks for custom taxonomy
- Taxonomy archive showing no results
- Dynamic loading of Archive content based on custom taxonomy term name
- List taxonomies according to whether this post is in another taxonomy in taxonomy archive
- Why is the custom taxonomy archive page redirecting me to a single post? [closed]
- How to have two different versions of a tag/category/taxonomy archive page?
- Automatically Give All Custom Post Types a Pre-Set Category [duplicate]
- How to add Post Format Taxonomy Archive page in the menu?
- How does WordPress Parent-Child Taxonomy actually Works?
- Custom taxonomy archive shows 404 error
- WordPress Tag or Custom Taxonomy Return All Posts if has that Word in Post Title
- Custom Taxonomy Not Working When added to WordPress Search
- Custom Taxonomy index/archive hierarchy
- Filter custom taxonomy archive posts by 2nd custom taxonomy using select dropdown
- Custom Taxonomy Term Archive Page Template that Filters 2 or more Taxonomies
- How to use multiple archive templates for a taxonomy?
- Removing “s” from search with custom parameters
- how does the wordpress rest API work
- pre_get_posts post_meta event
- Taxonomy archive template that shows posts from more than one taxonomy
- Custom Taxonomy List with Children
- why the archive of custom taxonomy term shows nothing?
- Can I output a custom taxonomy as a submenu in the site navigation menu?
- Amend taxonomy to search in wordpress admin
- Main query disturb pre_get_post by category query
- Random order not working correctly when using default loop + $query->set
- How to exclude woocommerece product category in search results?
- Custom Taxonomies Archive Page 404
- How to create archive pages for metadata query generated posts (so without taxonomy)?
- How to create a completely functioning separate archive for posts from only 1 or 2 specific categories
- How to pass posts_per_page and paged params query vars to custom taxonomy archive urls?
- Pre_get_post custom taxonomy combined with custom fields?
- Hierarchical taxonomies in permalink cause 404 for sub term archive
- How to get a terms and posts associated with another term?
- Change the Page Title of the Archive Page for Portfolio Tags
- Custom taxonomy return 404
- What’s the url queryvar for a taxnomy archive?
- Multi level archive
- Custom Taxonomy Archives Page Errors
- index.php Not Showing Custom Posts / Terms
- Custom Taxonomy Archive Page for Parents AND Children?
- Redirect or Prevent Viewing of Custom Taxonomy’s Archives?
- Creating a Taxonomy Page [duplicate]
- Include attachments with a custom taxonomy in search
- Insert code on specific taxonomy archives
- Permalinks not working on MU network with domain mapping
- Custom Taxonomy Archive URL rewrite
- Can I use $query->set() (in a pre_get_posts() hook) with a custom taxonomy in WP 3?
- Can you orderby slug in a taxonomy archive page using WP_Query?
- More than one Hierarchical Taxonomy and SEO
- Getting Catategory / Taxonomy Description on Non-archive Pages
- get_the_terms inside save_post gives old terms
- Taxonomies starting with a hyphen (minus) to assign B.C. dates to a post
- Custom taxonomy archive empty
- Querying posts globally based on custom taxonomy with its own taxonomymeta table
- Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)
- Why my archive title isn’t showing?
- Creating a custom archive page for WooCommerce products based on tags
- Hide empty categories on widget
- How to modify the query in taxonomy-custom.php to sort term archives by a custom meta field?
- wp_options table value
- wp_query orderby title and meta key value (WP3.1)
- custom taxonomies on permalink
- Custom Taxonomy tree view not showing correctly in backend
- Category page for custom-taxonomy shows 404 when using custom permalink structure
- Hook to change Custom Tag Taxonomy Links?
- Search functionality in ‘taxonomy postbox’ on edit post page
- Display only child terms of a specific parent term of a custom taxonomy, for each custom post
- Are exclusive taxonomy terms possible?
- My custom taxonomy page is leading in 404 page
- Get list of taxonomies associated with users
- Taxonomy.php how to show post only in current taxonomy with wp_query?
- Custom taxonomy if statement
- How do I check to see if a specific child term has shared posts with another set of child terms within the same taxonomy?
- Multiple taxonomies, what should the permalink look like?
- Child Pages and Custom Taxonomies
- How to edit wordpress post without republishing
- Saving Taxonomies to Post Revisions
- Error when adding custom taxonomy to wp nav menu
- How much worse is querying custom fields compared to custom taxonomies, quantitatively