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)
- Random sort within an already sorted query
- Search by Hyphen
- Display the latest post from a category in a page
- How to show list of posts by author and category?
- Getting Position of a post in a category
- Keep getting same permalink with WP_Query?
- Display only posts from a specific parent category
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Create new WordPress post [wp_insert_post] based on results of a WP_Query
- Custom Order in WP Query
- How to add terms to my tax_query based off of the current post
- Search query – exact post title match
- How to get most recent commented post above new submitted post in WordPress?
- Display posts in three columns by category
- Deleted category by mistake, all posts now have categorized category. Can i revert that?
- Automatically Updating Publish Date Bug
- Get authors by term id or slug
- How to make multiple sections in home pulling posts category wise?
- how can i change WP main archives loop to sort by name or title
- Change default category when I publish a post
- Get posts from multiple tax terms
- why the same code got different results when using query_posts in functions.php and index.php
- WP_Query: Show 10 posts in date order, first three random
- Exclude post category in a blog page
- How to make posts being uncategorized
- How to display a single(current) post from a category
- WordPress Query – Display 5 posts (same post type), each from a given tag
- While loop in functions.php outputting the_title() of each post on frontpage
- How to Create another Page Category like the “Post” and “Pages”
- Is there a way to save different data when USER interacts with the same POST?
- WP_Query that targets all categories
- Fill the exclude array() in get_posts()
- Category posts show on local install, they do not show on live server
- Custom layout manager for posts
- How to pass multiple checkbox values to wordpress query?
- How to filter categories of a post
- How to get single post by one author?
- how to show all post with its contents
- How to make category for word post_content