http://wordpress.org/support/topic/get-tags-specific-to-category
$category_tags = $wpdb->get_results("
SELECT DISTINCT
terms2.term_id as tag_ID,
terms2.name as tag_name,
t2.count as posts_with_tag
FROM
$wpdb->posts as p1
LEFT JOIN $wpdb->term_relationships as r1 ON p1.ID = r1.object_ID
LEFT JOIN $wpdb->term_taxonomy as t1 ON r1.term_taxonomy_id = t1.term_taxonomy_id
LEFT JOIN $wpdb->terms as terms1 ON t1.term_id = terms1.term_id,
$wpdb->posts as p2
LEFT JOIN $wpdb->term_relationships as r2 ON p2.ID = r2.object_ID
LEFT JOIN $wpdb->term_taxonomy as t2 ON r2.term_taxonomy_id = t2.term_taxonomy_id
LEFT JOIN $wpdb->terms as terms2 ON t2.term_id = terms2.term_id
WHERE (
t1.taxonomy = 'category' AND
p1.post_status="publish" AND
terms1.term_id = '$varcat' AND
t2.taxonomy = 'post_tag' AND
p2.post_status="publish" AND
p1.ID = p2.ID
)
");
change ‘category’ to your custom taxonomy name
Related Posts:
- How to add custom taxonomy slug in CPT permalink?
- WordPress different custom tag being displayed in on tag list
- Get category name of current post (CPT UI)
- I want to show image from custom field image on my custom page template
- How to make multiple custom taxonomies sit under custom post type slug?
- Show all terms of a custom taxonomy?
- Call to a member function add_rewrite_tag() on null
- How to Add Custom Fields to Custom Taxonomies in WordPress CLEANLY
- Get Custom Taxonomy ID within loop
- Creating custom Woocommerce attribute taxonomies from a plugin
- Get custom post type by category in a page template
- How to paginate a list of custom taxonomy terms?
- Categories under custom post types doesn’t show properly
- Filter posts with ajax form and checkboxes
- Get used terms by an author as array of strings
- How to get only one category of custom post type?
- Get all taxonomies for all post types
- Append taxonomy terms as class names in markup?
- List terms from Custom Taxonomy
- Include a specific post to the query_posts and remove it if it is already in the returned list
- WP_Query search posts by custom post type and custom taxonomy
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- How to output wordpress custom tags separated by comma?
- get_terms orderby numeric
- Sum custom field values of particular taxonomy
- Query all posts of a custom taxonomy term
- get_posts of Custom Post Type AND Custom Taxonomy
- Received nothing after executing AJAX post function
- Create a hierarchical taxonomy list in WordPress
- Randomly Assign an Image’s Alt Text Based on Data From Post
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- How to get original custom taxonomy slug after the slug has been rewritten?
- Displaying custom taxonomy on WooCommerce product page
- Categorize custom post type
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- multiple taxonomy select display only one in front end
- How to show only subcategories in parent category not parent category?
- need help with existing code showing subpages
- Custom field values to taxonomy terms
- Get term name without a foreach loop
- WordPress custom taxonomy not showing
- Copy taxonomy terms from one post to another programmatically
- Get custom post type categories to show up in menus
- working with term_relationships table
- Show current custom taxonomy
- How to filter custom taxonomy term name, slug, and description?
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- fetch woocommerce product with custom taxonomy
- Create a a form for custom taxonomy terms
- Foreach loop returning more than one item when querying taxonomy
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- WordPress custom taxonomy
- making php value numeric
- how to insert content into my taxonomy
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- Create a Dropdown Selector and Redirect for a Custom Taxonomy in WordPress?
- Show related products by attribute based and certain conditions
- set object terms after some some time of published post – functions.php
- How to hide a child category and show his parent category
- How to update posts’ custom taxonomy selection?
- How to retrieve taxonomy Metabox fields in frontend
- How to add Text before my Custom Term and hide it when empty
- Assigning categories to custom post types via a front-end form; only works for native post type
- ACF – Can’t get custom post type by taxonomy
- Taxonomies are not showing in the category dropdown
- Combine multiple separate lists into one
- Show parent category and subcategory once in while loop
- Using Sprit-sheet on WordPress categories
- Custom Taxonomy – fields
- How to insert text into post based on category – via single.php file
- Get Posts by Custom Taxonomy on Custom Post
- The most recent post of custom taxonomy
- str_replace not preserving whitespace
- Show tags of custom post types in WordPress
- How to replace hard-coded list of custom taxonomy terms based on custom field query [closed]
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- Custom Taxonomy Link Text Echo Name Not Slug
- Custom Taxonomy as Link
- WordPress Rewrite Issue
- Limit Taxonomy Parents
- Values inside a custom field to determine which category posts to display
- Get category id for a custom category and display it in a class
- Show Custom Post Type taxonomy term that matches custom field
- Saving category as insert post
- Display a query with multiple post types and same relationship on a single page
- Order by custom field attribute
- Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax
- Inserting two categories
- How can I change the URL via add_rewrite_rule()
- How can I get values from a custom post type depending on where I click on my SVG map?
- How to enable REST API on custom post type without Gutenberg?
- Can I associate a custom post type with another custom post type?
- How do I organize posts based on their taxonomy?
- How to use multiple custom post types to archive as front page?
- WordPress taxonomy and terms question
- Load style and script for custom post type metabox
- Custom CPT – Programmatically create categories to assign CPT when a new one is created
- How do I exclude the current post from the upcoming post query
- Custom Filtering date with newsletter