Working off of Pieter Goosen’s answer to this question, the way around this is to create a list of all the categories except the one you want to exclude, then search for posts that include them. That way, if a post has the excluded category but also other categories, it’ll be included. So, in my case:
$args = array ('exclude'=>1,'fields'=>'ids');
$exclude_uncategorized = get_terms('category',$args);
and then include the following in the $args
for the wp_query
:
'category__in' => $exclude_uncategorized,
Related Posts:
- Page with Category Returning 1
- Displaying Results From Custom Taxonomy Query
- Get Posts Under Custom Taxonomy
- Different post sort order within different categories
- Displaying the category name of a custom post type
- MySQL Query to Retrieve Category from wp_posts
- How are terms connected with posts in database?
- Show related posts by category but ignore one category
- Show Custom Taxonomy Categories, Listing of Posts, and Single Post via AJAX
- Importing data from spreadsheet into wordpress DB, along with custom taxonomies and their terms
- prevent showing posts of an specific category in admin posts section
- List all custom post type posts from a given category?
- get_terms parent for current product only
- deleting terms programmatically
- Adding Multiple Values to a Post Meta Key
- How do I get the slug of a custom taxonomy category of a post?
- Get taxonomy terms only of the WP_Query current posts
- Exclude posts from featuring
- How can I remove posts of a certain category from homepage after a specified time period?
- List posts in a given category
- Avoid duplicate post from same Taxonomy
- Set terms in a custom post
- Get posts of ONE taxonomy term of custom post type
- Setting posts_per_page for taxonomy term template
- How to Restrict Previous & Next Post Link to Posts of Same Category?
- Get user categories with most posts in it
- Get Posts Under Custom Taxonomy
- Prepending %category% onto default posts fails
- How can I setup a relationship using categories in WordPress?
- How to display posts via custom taxonomy terms using checkboxes?
- How can I hide tags on a child-category page, if that tag has not been used?
- Redirect to another page using contact form 7? [closed]
- Loop parent terms {display posts} AND loop child terms {display posts}
- Loop doesn’t exclude the specified category in home page
- Display posts of specific category term
- WordPress bulk category select when publishing post
- Migrate posts from category and sub-category via SQL
- Parent category / child category posts
- Unable to differentiate between two categories under custom post type on single.php
- WP_Query of Category Not Showing First Post
- Sidebar limiting to 10 posts?
- Geting error in post and category [closed]
- WP query taxonomy optimization
- Query prints posts without specific categories
- Create/Set Category as Title of Post
- show image gallery in archives or category page
- Get 5 most recent categories
- How to get post count including nested categories
- How can I display a specific number of post in a category via a url
- Order posts by separate menu order for different sub-categories
- Retrieve latest post by multiple categories with ID
- Make assigning post to a specific category equivalent to assigning it to all categories
- Multiple loops on a Search result page?
- How to get all the terms of a post
- How to Include a common category in a custom Category Search
- WP_Query: Fetch posts that are in (category1 and not in category2), OR posts that are not in cagegory1
- Exclude sub sub categories from displaying in the archive page
- List posts related to category on a div [closed]
- Taxonomy Category category.php not working
- Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]
- Filters do not work when there are multiple (one works)
- WP_Query orderby not working with meta_value_num and menu_order
- Child_of not displaying all children posts.. via get_posts
- Using wp_list_categories like the the_category (showing just current categories of a post)
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Custom WP_Query with complex ‘post_status’ argument
- How can I sort posts by the date and a custom meta field?
- Saving category to a post, before publishing the post
- is there a way to show the the post title after the image?
- Pass data between pages
- Duplicate posts and change category
- Should I use posts or pages in this scenario?
- recent posts for different categories
- Category Foreach keeps looping?
- Using permalinks, category slugs, and tag slugs
- post categories
- How can i insert term in a specific language of Polylang?
- Choose whether to automatically add a taxonomy with the same name as the post
- Display Featured Post by Categories and Avoid duplicated posts
- Why does the argument list_only do on Walker_Category_Checklist::start_el?
- Search by post title and content in wp_query without order
- Hiding Draft Post In Admin
- Exclude category from
- How to limit posts by category
- Display tag image in post using Taxonomy Images plugin index.php
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- wp_get_object_terms returns only Uncategorized on first publish
- Get authors by term id or slug
- Assign category to new post via URL
- Blog post per page setting conflicting with custom WP_Query?
- Change post order random through out the entire WordPress
- How to insert 2 args into 1 Wp_Query for a slideshow
- How to exclude latest x posts from a paginated query?
- Setup a custom dynamic post
- Custom post taxonomies as tax_query terms?
- Stop users posting into category while still seeing contents of the category
- Anyway to grab author name and featured image in an embeded in inital array of posts outside of loop?
- How to verify wp user password by sql query in wp? [closed]
- Removing noindex posts from wp_query
- Category Page Template not Showing Posts