If your custom taxonomies are unique to the custom post type, then you can set post type to an array ie post_type => array('cpt1', 'cpt2'),
knowing that the taxonomy filter will only return the relevant post types.
Secondly, in your tax_query, change catcocktails
to get_queried_object()->taxonomy
which will make it “dynamic”.
Related Posts:
- How to get all taxonomies of a post type?
- Set relationship between custom_post_types
- How to build a complex page structure
- Remove admin menu for custom taxonomy attached to custom post type
- How do I list custom taxonomy terms without the links?
- Page not found taxonomy custom post type
- How to list custom taxonomy categories?
- clients list using wordpress
- Custom taxonomy query for a custom post type
- Extend walker class with custom post types [closed]
- How to do a custom bookmarks post type?
- Getting taxonomy terms used by custom post type
- How to display Custom Taxonomy of Custom post type
- associate custom post type with tags with specific pages
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- How to customize admin posts based on the user who is logged in
- taxonomy template for custom post type the same as the archive
- Get categories and descriptions from custom post type
- Custom taxonomy template for multiple custom post types
- Custom Post Types for Support Ticket plugin?
- Problem with custom post types, taxonomy and permalinks
- Add/Remove current_page_parent class
- Repeating posts when paginating random posts
- Use different taxonomies in different custom post types’ permalinks?
- Query/list all terms and their custom post count
- Get custom taxonomies from multiple posts
- How can I make a custom post type sticky?
- Categories of custom taxonomy don’t show any posts
- Get Taxonomy Term Title by it’s URL
- How to use terms from the same custom taxonomy in different roles in a custom post type?
- How to have the same url structure for both a CPT and a Taxonomy?
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Group CPT posts by custom taxonomy
- limit value taxonomy based on previous taxonomy value wordpress
- Limit number of custom posts per taxonomy
- Number of Custom Post Types published are not being shown in the custom page
- Load Custom_post_type categories post with ajax
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- How can I get this request to use the Custom Post Type page template instead?
- Include custom taxonomy term in search
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- How to solve this custom post type goes to 404 page?
- custom post type and custom taxonomy
- Custom Post Type with Custom Taxonomy as Category
- WP_Query() with custom post type and taxonomy — get all terms?
- Get custom post type categories to show up in menus
- Custom Type add Transitions
- How do I get the custom category URL from the custom post type?
- Custom Post Type Advanced Slug
- Taxonomy template page not working
- Custom post type subtaxonomy template
- tax_query (if the terms are empty)
- Getting only one post per category
- Should putting custom code in functions.php or created the plugins [duplicate]
- List all posts in taxonomy term
- Get posts by category name
- List child categories from parent category on custom taxonomy page
- Create a custom taxonomy template that loops through child categories in term order?
- Can’t Get Parent and Child Categories of Custom Taxonomy to Display
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- Create a Dropdown Selector and Redirect for a Custom Taxonomy in WordPress?
- How to Implement Search Functionality?
- How to implement very unusual wordpress routing structure?
- Search CPT by tag ids
- Custom post type 404 category page
- Post template with breadcrumb needs to show page navigated from
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- Changing permalink of default Post with custom post
- get_queried_object not work in taxonomy page
- wp_insert_post deleting previous post custom meta
- Combine multiple separate lists into one
- Change custom post taxonomy values from front-end
- Pages of my taxonomy terms are showing all posts
- How to create a permalink structure with custom taxonomies and custom post types
- Is there a way to re-order the Custom Taxonomy drop-down on a Custom Post listing page?
- How to get all posts related to a taxonomy?
- Custom post types not displaying per category
- Custom Post Type tag taxonomy “Page Not Found”
- Remove custom post type slug but keep related category taxonomy permalink
- page not found for example.com/custom-post-name
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- Custom post type and custom taxonomies display
- Hierarchical taxonomy in permalink structure
- predefined custom field on registration page
- Displaying taxonomy icon outside archive page
- Why won’t this rewrite rule work?
- Archive.php is not displaying tags
- How to not have the items of the subtaxonomy within the parent taxonomy
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- How to save an integer as taxonomy term?
- Sort custom post type items by taxonomy description
- Tags and Taxonomy links not working for Custom Post Types
- Get custom post type parent category
- How to manage a bookstore
- How can i change url structure of cpt like this?
- Custom Post Type urls not working
- pre_get_posts causes Custom Posts appear under ‘Pages’ menu
- Show a wordpress custom post condtionally using a category term