After some research I came up with the following
// Get the posts in that category with the required tag
$args = array(
'post_type' => ['documents','news'],
'fields' => 'ids', // Only get post IDs
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'forms',
'field' => 'slug',
'terms' => $symbol
)
)
);
$posts_array = get_posts( $args );
$categories = wp_get_object_terms($posts_array, ['sources','articles'], ['fields' => 'id=>name']);
Related Posts:
- show tags of custom post type ONLY
- List all custom post type posts from a given category?
- Category page only displaying the posts from a custom type
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Need help deciding on a taxonomy
- Get Posts by Category, Tag , and CPT Taxonomy
- The Difference Between Categories and Tags and Taxonomies and Terms
- Custom post type, taxonomy and admin bar
- Is There a Difference Between Taxonomies and Categories?
- get_terms by custom post type
- How to change permalink structure for custom post type and it’s taxonomies?
- Get the first post term
- Control term order on a per-post basis
- Creating “static” taxonomies to choose from, inside custom post type?
- How do I list custom taxonomy terms without the links?
- Load custom posts with same tag as page
- wp_insert_term doesn’t work with custom post type’s taxonomy
- How to list all categories and tags in a page?
- Retrieve single term slug
- How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?
- display multiple term post from taxonomy in a single page
- Glossary with Custom Post Type
- How can you make permalink work for custom post type and taxonomy?
- Get list of terms of current taxonomy archive for another taxonomy
- get_terms won’t display product_cat or any other custom taxonomies when specified
- How to get category image custom post type taxonomy in wordpress?
- Show Post Count of a Category
- Search doesn’t find tags or categories in custom post types
- Custom Post Types and Categories?
- How to make a custom taxonomy selectable in post publish area?
- Have a Custom Post Type index page display taxonomy items instead of posts
- How to create new category for custom post type?
- Get Post Primary Category
- How to check the terms in single custom post type template
- Pagination is not working on single-{slug}.php but works fine on page-{slug}.php
- How to get the post type from a category id?
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- How to show CPTs in term archive
- Group posts by custom post type
- Display all posts in main category and 1 subcategory
- Custom Post Type Archive Page Filtering
- Show category ID on custom post type
- Allow user to set custom order to a list of custom taxonomies?
- Custom post type getting wrong categories and tags
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- Limit amount of posts made within a custom taxonomy
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?
- How to get custom posts sub category link
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- Tag page only display 10 posts
- Category archive in with conjunction with custom post type is empty
- get_category_link() for custom post type does not include custom slug rewrite?
- How to Display Posts From Category Within a Custom Taxonomy?
- Why does my taxonomy have a category style div id?
- Targeting categories in custom fields
- Invalid Taxonomy
- Get category if used in a custom post type
- Categories won’t appear on custom post type
- Custom Taxonomy Terms in Menu lead to which page?
- Get terms for a specfic post from multiple taxonomies in custom post type
- Custom Post Type Taxonomy Term Order by Title
- Retrieve Custom Taxonomies with Description and Slug
- Advanced archive url structure (category, tag and date)
- Displaying taxonomies as category links within sidebar and creating pages for these
- How to automatically create a terms based on each post of a post type
- Get List of Terms based on a given term (different taxonomy)
- CPT : Next or Previous term link when has not adjacent post
- Custom post type archive page filters
- How to show related posts of category on post within custom posttype
- Display Custom Post Type Based on Taxonomy With WP_Query()
- How to order taxonomy terms by most recent post?
- How to set “section categories”?
- Create custom post type categories
- Cannot get to work tax_query array for terms
- Set a Default CPT taxonomy by taxonomy id
- how to create custom taxonomy drop downs for parents and child
- How to manage a dynamic multi-level page hierearchy system?
- Categories manage
- Automatically / dynamically populating tags in custom post type
- Pages of my taxonomy terms are showing all posts
- I can not call the categories of custom post type
- Reuse the “category” slug for a custom post type
- How to create groups like that in buddypress?
- Update Cateogory Taxonomy Count for Attachment Post Type
- Filter Term By Parent Term – Custom Post Type
- Create an additional template page for every term taxonomy
- Custom Post Type – Admin Columns
- Taxonomy count per Post type
- Best way to structure article and issue relationship for CPT
- Taxonomy Grid Archive Help?
- Custom Post Type used for FAQs Accordion
- Get a list of categories ids
- List a custom post type’s posts ordered by nested custom taxonomy
- Author template – separate custom post type by custom taxonomy term for $curauth
- Custom Post Type order Title ASC
- get_the_term_list() wanting to loop through the returned values
- show only one category posts in admin
- Taxonomy Archive URL + Template