Queries (both WP_Queries and raw SQL queries) are meant to select objects matching given criteria.
“One post from category and one not from category” is not a description of set of posts – it’s description of two posts coming from different sets.
This means you won’t be able to select these two posts using only one query…
So yes, you’ll have to use two queries for that.
Related Posts:
- WordPress tax_query “and” operator not functioning as desired
- Custom taxonomy query broken after upgrade to 4.4
- Show posts without term
- Display posts the match taxonomy term linked from wp_list_categoies?
- Query two taxonomies via URL or link?
- Counting number of posts with Category B in Category A
- Custom archive page based on array of categories and tags
- Select posts wich has no relationship in custom taxonomy
- List taxonomy terms plus their latest post ordered by post date
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- Filter and list posts of a custom taxonomy
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- tax_query shows no results if nothing is selected
- Get array of current post term ID’s
- Setup of taxonomy term template pages
- How to do a query on custom taxonomies that is uncategorised?
- WP_Query, tax_query and term_meta: How to?
- Order taxonomy terms in alphabetical order
- Query Custom Post Type Order By Taxonomy Field
- Query post from all category with same tag on 1 pages
- Query with custom taxonomy not working
- Function get_queried_object() return NULL in custom taxonomy
- Order posts by taxonomy count
- showing all search result in one template
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- List custom taxonomy terms sharing posts with a term from a second custom taxonomy
- Query custom post type by custom taxonomy (category slug)
- How to Filter Posts by Custom Fields?
- Show posts from a custom taxonomy on a page
- wp_query for multiple cities (multiple values in a metabox)
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Query with relation and one without relation using multiple taxonomies?
- How to display an other custom post type in a different custom post type’s archive?
- Search form not working with custom query?
- Display custom tags on pages that have a specific page parent
- wp_query args adding muitiple tax_querys
- find posts that don’t have a custom taxonomy
- Custom taxonomy.php not working
- Filter Custom Taxonomy Posts
- WP_Query args to show posts from specific custom taxonomy
- WP_Query for a taxonomy with different taxonomy types
- get all posts associated with a custom taxonomy
- How to set an alternate posts_per_page value for default queries in different templates
- Using custom taxonomies in a query
- Tax Query only returns for the first of several terms
- Can’t fetch Custom Post Type Data through Custom Query
- get term id from term name
- WP_Query to output chosen term and posts with no term assigned
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Check if a post has term inside loop
- How to get posts by category and by choosing a taxonomy term?
- How to restrict search on a certain page to only return results against custom taxonomies?
- Query Taxonomy By Page Title
- Custom Taxonomy Breaks Pages
- get_the_terms has strange result since version 6.0
- How to display posts from custom post type category(custom Taxonomy) wise?
- wp-query and wp_get_post_terms on custom taxonomy archive page
- Show X taxonomies of the latest published posts
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- display ACF repater field in archive page
- Filter for each loop when WP_Query has no posts to show
- Custom Taxonomy – Modify Function to Get Child Category
- wp_set_object_terms() custom taxonomy not working correctly when using insert post
- How do I stop the same post showing multiple times in a archive?
- Related categories order posts by category
- WordPress – Form does not filter the results of taxonomies
- How to get taxonomy image attached to a Post Type WordPress
- Show one post of each custom taxonomy
- Query WP Posts, then list the taxonomies from those posts
- Displaying Pages in Nav Sub-Menu with Specific Taxonomy Terms?
- Optimal way to make tags in tax_query optional?
- How to define a custom hierarchy for terms?
- Taxonomy Terms That Don’t Exist Display Results
- Adding additional taxonomies to wordpress taxonomy page
- How to create page that lists tags by initial letter?
- How can I get all the posts that are related with a specific taxonomy term?
- How to combine nested tax_query logic with other nested query logic?
- Query Top Set Custom Taxonomy In Given Timeperiod
- tax_query not working for taxonomy slug
- Rewrite rule pagination on different url levels
- Select posts wich has no relationship in custom taxonomy
- How to get hierarchical number of custom taxanomy
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- WP_Query to show post from a category OR custom field – Not 100% answered
- Get newest value of an array
- Filter custom post type by custom taxomony
- Page displaying 1st post from a range of custom tax?
- WordPress WP_Query Array Custom search via taxonomies
- query_posts problem – need help
- WP_Query and DES sort for Custom Taxonomy based upon a meta field?
- tax_query not working properly with get_posts
- Give attachments an archive page, and exclude unattached ones
- Custom Taxonomy in custom REST API search
- I’m trying to get posts under a custom taxonomy but I don’t know what I’m doing wrong here
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Display Featured image from custom post type category (custom taxonomy) wise
- Filter on one post type with taxonimy and get other post type
- Include custom post type that matches taxonomy field in another custom post type
- Showing all posts of the current custom taxonomy on archive page
- has_term not returning anything