OK, so you have few mistakes in there.
fieldcan beterm_idorslug, but notid.tax_queryshould be array of arrays and not an array.
So here is fixed code:
function exclude_category( $query ) {
if ( is_user_logged_in() && $query->is_main_query() ) {
$taxquery = array(
array(
'taxonomy' => 'project-type',
'field' => 'term_id',
'terms' => array( 94 ),
'operator' => 'NOT IN'
),
);
$query->set( 'tax_query', $taxquery);
}
}
add_action( 'pre_get_posts', 'exclude_category' );
It’s not tested, but I’m pretty sure it should work just fine.
Related Posts:
- Querying Term Posts in Loop
- How to divide Subcategories into pages of parent category wordpress
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Custom-Taxonomy as categories: Remove “most-used” tab?
- SQL to update custom post taxonomies
- Query multiple taxonomy in Custom Post Type
- Querying Posts by Taxonomy From Alternate Network Site
- Add filter to wp_list_categories and query what type of taxonomy-terms it use?
- Limiting number of custom posts shown on taxonomy page
- Include custom post type in “all posts”
- Custom edit post column – category not showing
- Include different loop templates in search query
- How to show custom taxonomy in the permalink?
- pre get posts changing the query
- Custom post type taxonomy template
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Taxonomy structure of Sport site
- Using pre_get_posts to Filter Posts
- get_categories() for only CPT
- WP_Query search posts by custom post type and custom taxonomy
- custom taxonomy archive by year
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Weird problem happening with custom taxonmy when creating/updating posts
- Custom Post Types and independent Categories – complex Taxonomy
- Should I use custom taxonomy or custom post type
- Am unable to reset a query properly
- Custom Post Type Archive Page Filtering
- Posts from all the categories are being displayed instead of particular category
- Get next and previous 3 posts in a term in single post page
- Conditional Statement custom post type category
- Custom Post Type With Categories
- Making certain categories of CPT not publicly queryable
- Categories sorting
- Allow user to set custom order to a list of custom taxonomies?
- Showing posts from different categories and from custom post type
- Show a Category X’s custom post type on Category X archive page?
- How do I move/order posts with a tag to the end?
- Limit amount of posts made within a custom taxonomy
- Filter CPT posts by one or more categories
- Getting categories of posts under a custom taxonomy
- Specific query for custom post type
- How to edit this code to get the categories in achieve page?
- Display post content with respect to its title?
- Hierarchy and access control for Custom Post Types (CPT)
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- First custom field value (out of several) displayed twice after query
- WP_Query orderby and tax_query
- browse by category and tags?
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Query multiple taxonomies with pre get posts
- Get parent category id from child category page for custom taxonomy
- How to add current custom taxonomy slug to body class
- List Posts By Custom Taxonomy
- How to Display Posts From Category Within a Custom Taxonomy?
- Disable custom taxonomy on admin bar
- how to show records that don’t have custom meta value
- The Difference Between Categories and Tags and Taxonomies and Terms
- Custom Post Type Categories URL not displaying posts
- Get child categories of custom taxonomy category?
- Create query for both custom post type and category
- List child categories from parent category on custom taxonomy page
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Custom post types category
- Custom taxonomy query showing more than 4 posts
- Get terms for a specfic post from multiple taxonomies in custom post type
- Custom post not appearing under custom taxonomy category
- Query Custom Post by taxonomy multiple categories
- Custom post type category permalinks and archive pages
- how to organize my categories or should I do custom post types for some?
- Advanced archive url structure (category, tag and date)
- Using get_terms() to list terms from one custom taxonomy AND from one specific built-in category
- Can’t Get Parent and Child Categories of Custom Taxonomy to Display
- Custom front-end form for adding post – Category problem
- How to show related posts of category on post within custom posttype
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- How to display custom taxonomy term specific post?
- Displaying all posts by category and showing content on click
- Show Custom Post Type based on Category on Archive Page
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- Custom category taxonomy – archive page not showing up
- Set different posts_per_page for custom post type/taxonomy
- Custom post types not displaying per category
- Custom post type category archive URL redirects to home page
- Get posts of an specific term of a custom taxonomy
- Dropdown switching subcategories portfolio
- Display custom Taxonomies same as listing Categories
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Display 2nd category, only once, as sub-heading, in the loop
- Problem to show custom post type in archive page category wise
- Query Only Show Text on Posts With Certain Taxonomy Tag
- how to limit query_post to first page?
- Category / Custom Post Type permalink issue
- Listing custom post type items from a couple of custom taxonomies
- Return Custom Post Type Categories
- Remove slug from Custom Category Permalink + dual-category permalinks
- Is it possible for post and custom post type to share a category base slug?
- WP Query filtering by custom category not showing all relevant posts
- Search for portfolio tags & mixing portfoliotags and post tags