You can do what you want with the tax_query
parameter since version 4.1, use EXISTS
as the operator parameter in your tax query.
$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'mytax',
'operator' => 'EXISTS'
),
),
);
$query = new WP_Query( $args );
Related Posts:
- Custom archive page based on array of categories and tags
- tax_query shows no results if nothing is selected
- Query Custom Post Type Order By Taxonomy Field
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Custom taxonomy.php not working
- list all post who have mutual taxonomy as current taxonomy!
- Taxonomy archive, categorised by other taxonomy, not hiding empty taxonomies
- Taxonomy Terms That Don’t Exist Display Results
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- WordPress tax_query “and” operator not functioning as desired
- Custom taxonomy query broken after upgrade to 4.4
- Show posts without term
- Custom Taxonomy and Tax_Query
- Display posts the match taxonomy term linked from wp_list_categoies?
- Query two taxonomies via URL or link?
- WP_query taxonomy + get all posts with two terms from same taxonomy
- Counting number of posts with Category B in Category A
- SQL Statement generated by WP_Query not producing expected results
- List taxonomy terms plus their latest post ordered by post date
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- Advanced Tax Query
- Improving WP_Query performance for multiple taxonomies
- get complex results set according to category structure
- 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
- Shortcode to show thumbnail and link for 3 random posts
- Query post from all category with same tag on 1 pages
- Query with custom taxonomy not working
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Advanced Query Logic With Multiple Taxonomies
- 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
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- wp_query for multiple cities (multiple values in a metabox)
- Combining categories (Query posts with multiple taxonomy terms)
- 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?
- Display custom tags on pages that have a specific page parent
- wp_query args adding muitiple tax_querys
- Automatically Query Parent Taxonomy
- Query most popular terms by taxonomy over 2 week period
- find posts that don’t have a custom taxonomy
- WP_Query args to show posts from specific custom taxonomy
- WP_Query for a taxonomy with different taxonomy types
- How to set an alternate posts_per_page value for default queries in different templates
- How to add custom meta to ‘pre_get_terms’?
- 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 Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- One WP_Query that always shows 1 post from category X and 1 post from “not in category X”?
- How to print term name inside wp post loop
- check if a taxnomy queried in $wp_query?
- WP_Query tax_query – Show results if child has parent X
- Tax_Query using WP_Query not working
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- wp-query and wp_get_post_terms on custom taxonomy archive page
- Why is my pagination /page/2 taking me to index.php?
- 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
- How do I stop the same post showing multiple times in a archive?
- wp_query with meta_query and tax_query
- Related categories order posts by category
- WP Query for all events prior to current date
- Why pagination is not working with tax_query param?
- Query WP Posts, then list the taxonomies from those posts
- Displaying Pages in Nav Sub-Menu with Specific Taxonomy Terms?
- Displaying posts from sub taxonomies only
- My entry results are not consistently alphabetized
- Combine Tax Archive and Meta_Query in WP_Query
- I cannot get tax_query in get_posts() to work with custom taxonomy
- How to create page that lists tags by initial letter?
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- 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?
- Object of class WP_Query could not be converted to int inside shortcode
- tax_query not working for taxonomy slug
- Custom query for tag and custom tag from 2 post type
- WP_Query to show post from a category OR custom field – Not 100% answered
- List posts of terms but exclude one term
- Hiding all posts/products/pages from a site based on a custom taxonomy/domain name
- tax_query showing no results
- Page displaying 1st post from a range of custom tax?
- WP_Query on “property” in the options table
- WordPress WP_Query Array Custom search via taxonomies
- Output ACF field dynamicaly within a taxonomy loop [closed]
- tax_query not working properly with get_posts
- Give attachments an archive page, and exclude unattached ones
- I’m trying to get posts under a custom taxonomy but I don’t know what I’m doing wrong here
- Display Featured image from custom post type category (custom taxonomy) wise