You can use 'post_type' => 'any'
if you are not sure of the post types resulting from other query arguments.
According to documentation that is what happens by default when you use tax_query
:
post_type (string / array) – use post types. Retrieves posts by Post Types, default value is
'post'
. If'tax_query'
is set for a query, the default value becomes'any'
Outside of WP_Query
context you would probably need to get such information from global $wp_taxonomies
array, which track taxonomies and post types they apply to.
Related Posts:
- Custom taxonomy: same terms, but for different years
- get_terms return errors
- How to show only Standard Format post in my custom taxonomy page -wordpress 3.8.1
- Reproducing hierarchical list output from wp_list_categories(), using get_categories()
- Fast way to add countries as a custom taxonomy term?
- Is there a filter hook that I can use to change how taxonomy term names are displayed?
- How to Register and Display Widget for Custom taxonomy
- Show Custom Taxonomy Slug(s)?
- Custom Taxonomy Archive not displaying entries
- Exclude custom taxonomy tag from loop
- Hide custom field if empty
- Filter posts by custom taxonomy terms
- Function to remove archive sidebar for custom taxonomy?
- Automatically check parents (in a taxonomy) when child is selected
- How to add textarea field to taxonomy (tag)?
- wp_query get post custom taxonomy in search.php
- How to get every custom taxonomy names and urls?
- Get Custom Taxonomy Terms by Date
- Display specific Taxonomy Term from Custom Post Type
- Semi complicated custom taxonomy question
- Get wordpress taxonomy slug name(s) to use as div class
- How do I list custom taxonomy terms with the links?
- Echo the Last Child Taxonomy only (not parents)?
- How to query term_id of a Custom Taxonomy by name
- How to show parent taxonomy using get_the_terms?
- wp_insert_post custom taxonomy multiple Category not added
- query variables for custom taxonomies
- If Term Name Exists, Append a Unique ID to Slug
- Display all subterms of a custom taxonomy filtered by parent terms
- My list of terms of custom taxonomy displays 7 times
- Display Custom Taxonomy Name As A Shortcode
- Taxonomy template is not reading
- URL issue after setting up Custom Structure in Settings >> Permalinks
- How to assign a default/priority taxonomy to be shown in url in case two taxonomy items are selected
- Post filter with multiple checkbox taxonomy terms
- Combine Categories & Custom Taxonomy
- Custom dropdown search form that allows users to select option B based from Option 1
- issue with saving custom metaboxes fields
- Taxonomy template by post type
- How to loop through 1 CPT with 2 Taxonomies
- Custom terms in custom category taxonomy
- How to setup a taxonomy that can have only one post assigned to it?
- Grouped custom taxonomy query
- Create advanced portal website with sections – taxonomy usage?
- Custom Query for Taxonomy
- Adding a third custom taxonomies
- Multiple Inputs in a Customizer Control
- Embedding a SOAP Client into a WordPress Plugin?
- Rearrange elements outputted by comment_form()
- How to build custom WP admin with custom URLs
- Custom editor field displaying HTML in Visual editor
- generate unique number when registering a user
- How to set default values for options page
- How do I deque the default stylesheet?
- Using Custom Posts with Metaboxes and Drop-downs
- How to import custom data via XML, CSV, etc
- Widget Javascript code (ajax)
- Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area
- How to remove query string from static resource in WordPress?
- Modify a theme to insert custom widgets?
- Custom Field as Custom Taxonomy?
- How can I defer these JS files?
- How Can I Move Data From Form 1 To Form 2
- How to get Related Custom Posts?
- Background image not appearing
- Custom login with external provider iframe and data object
- get author in blog posts?
- Users can only view their content from the front end
- Widget title markup in register_sidebar
- Garbage in uploads folder
- What is theme-editor.tmp?
- More tag – how do I remove preceding ?
- Salesforce lead tracking with contact forms plugins [closed]
- How to customize shipping region/states on WooCommerce
- Stop Expansion of Top Level Menu in the WordPress Admin Sidebar
- Add or Create Custom Structure Tags to Permalink
- Remove welcome panel from contact form 7 page [closed]
- How to remove admin menu pages inserted by plugins and themes in the top admin bar?
- WordPress custom dropdown listings
- Do I need to instantiate the XMLRPC class or any class in another class to access its methods?
- Get custom field value from not-current page
- RSS feed showing deleted post
- Custom page template, not acting as page
- how or where wordress collect unlogged user session
- Customizing woocommerce product page
- Customizer options limited to specific user roles?
- Woocommerce custom “My Account” Tab – Add Save button
- WordPress Using Zip code customer shop find without woocommerce plugin
- how can custom permalink structure use for specify custom post type
- Add button to My Sites dashboard page (multisite)?
- Embedded Options in a Custom Metabox
- How do I display entries in the top menu based on conditions selected in the sidebar menu?
- custom loop issue
- Bulk product editing in wordpress
- Logged in only custom page
- Search results load individual post in slide out div
- Problem Locating and Changing Alt Attribute Of Link
- Show Site Name on WP login screen
- Adding css and js to a blank page created with custom template
- Conditional tag