The following code will do it. Please change the ‘filter’ text in the below code to whatever filters taxonomy name you have set.
if(is_category() ){
$thiscat = get_queried_object_id();
$filter_tax = array();
$args = array( 'category' => $thiscat );
$lastposts = get_posts( $args );
foreach ( $lastposts as $post ){
setup_postdata( $post );
$terms = get_the_terms( $post->ID, 'filter' ); // Change the taxonomy name here
if ( $terms && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$filter_tax[] = $term;
}
}
}
wp_reset_postdata();
if( !empty($filter_tax) ){
print_r($filter_tax);
} else {
echo 'No filter set.';
}
}
Related Posts:
- Order get_terms() By Custom Field
- How can I select a primary category?
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Removed slug from CPT, now How/where do I hook the filter to the taxonomy term archive pages link?
- Display empty taxonomy terms with get_terms()
- Limit number of terms that a custom taxonomy can save per custom post type
- Get posts from specific taxonomy term
- Display custom taxonomy attached to the post on post single page
- Ive got a term (get_term_by) but now I want to filter it by a category it is in?
- Get Categories Where Taxonomy Equals ‘n’
- Showing HTML if Post is In Certain Taxonomy Term
- Post to inherit custom category background image from parent
- List taxonomy terms assigned to a post in hierarchical view
- Ordering terms whilst in loop
- Get WooCommerce product category list in functions.php
- Display List of Categories Within a Custom Taxonomy
- List Terms by category
- Is There a Difference Between Taxonomies and Categories?
- Check if a post is in any child category of a parent category
- How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms
- Can’t custom taxonomies have same terms (slugs) as categories?
- get_terms vs. get_categories: does it matter?
- get_categories for custom post type with a specific custom taxonomy attached
- Woocommerce get category image full size
- Control term order on a per-post basis
- How can I add the featured image functionality to a custom taxonomy?
- Fixing category count
- Combine two taxonomies in a hierarchical tree
- How can I get category ID by category name?
- get_terms name__like list categories according to letter
- Use tag interface for hierarchical taxonomy?
- Elegant way to add parent categories?
- Using URL parameters, list posts from category and custom taxonomy
- Programmatically create product category and add thumbnail in woocommerce
- How to order the get_categories result
- How to make custom taxonomy check boxes like ‘Categories’
- Different templates for parent and children categories/taxonomies
- Send an email when custom post type category is changed
- cat_is_ancestor_of() for custom taxonomies
- How to create non-unique sub-category slugs?
- Show Post from parent category (custom taxonomy) ONLY!
- Excluding posts from a category but only if they’re not in multiple categories
- Glossary with Custom Post Type
- How to convert regular categories to custom taxonomy?
- How to get next previous category in same taxonomy?
- Update term count using a callback function
- Get terms that are associated with products from current category
- Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Getting the sub category
- Use get_term_children to get the sub category of a parent category for the current post
- Action hooks returning old category instead of new category
- Update wordpress post terms programatically
- Getting WordPress custom taxonomy/category?
- Are Custom Taxonomy Templates Possible?
- Order Taxonomy Term by date created
- How to display a description of a given category from a custom taxonomy
- How to get the number of child categories a specific parent category has?
- get / list categories and counts filtered by custom taxonomy term
- When to use ‘get_category_by_path’ vs. ‘get_term_by’ to get category object from `get_query_var( ‘category_name’ )`?
- How can I convert some categories to a custom taxonomy?
- Category tree is flattened inside admin upon saving
- Get multidimensional array that reflects category hierarchy
- PHP Fatal error: Cannot use object of type WP_REST_Response as array in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
- If statement within PHP echo
- How to know if it’s a child taxonomy?
- Taxonomies for WordPress Media Library [duplicate]
- List Terms in Category
- wp_dropdown_categories and custom taxonomy + custom post type
- How do I get a list of all categories that a given user has written blog posts for?
- display taxonomy slug from term ID
- Specifying multiple categories in URL (permalink)?
- Set post categories to include parents when setting child category
- Should the actual /category/ directory be 404? Is that normal WP behaviour
- How to get data about category in category.php
- Custom Post Type Archive Page Filtering
- Inserting Category programmatically
- Can you pre-check wordpress categories?
- Change existing taxonomy settings when using custom taxonomy
- Display Taxonomy Terms in an option tag with value being the slug
- Allow user to set custom order to a list of custom taxonomies?
- How to get the id from the custom category?
- How can i insert term in a specific language of Polylang?
- One Specific Category To Permalink
- Why does the argument list_only do on Walker_Category_Checklist::start_el?
- add_rewrite_endpoint returns 404 on archives
- How to organize custom categories for filtering and selecting
- Custom sub taxonomy order by
- Add category only if post has custom taxonomy category
- How to get custom posts sub category link
- Display Posts Loop for each parent and for each Child
- Categories overview that links to page displaying posts
- Is There a Difference Between Taxonomies and Categories?
- How can I edit the ‘Most Used’ tab in the categories meta-box to show another custom taxonomy?
- Get all media categories
- Add child category to parent on post creation and save
- Get Number of total Parent Categories for Custom Taxonomy
- Get posts under a category with SQL
- Getting category URL with hyphens, not spaces
- get_terms function not returning anything