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
- Taxonomy archive page have no post
- Index page of posts tagged with two separate taxonomies
- Display list of custom taxonomies from a custom post type ordered by their parent
- Multiple taxonomies, what should the permalink look like?
- How do you move custom fields to custom taxonomies using WP Queries
- WordPress hiding posts without content on custom taxonomy query. How to solve?
- Child Pages and Custom Taxonomies
- get meta fields and taxonomy of any post type
- How to make an sql query to exclude everything but custom taxonomy terms in table wp_terms?
- Custom taxonomy – query returns an error
- Where to put a migration script to switch post information?
- rewriting for custom taxonomy rewrite
- Display the first tag assigned to a post
- Change taxonomy of posts
- Custom Taxonomy registered with multiple custom posts
- Run next query based on first query’s term
- Query Number of Loaded Posts in Loop
- Producing a list of media library items categorized under a certain taxonomy item
- Why is it defaulting to “uncategorized” even after I select a custom taxonomy
- Get the original menu item name string instead of the label
- Custom taxonomy list in two columns