get_the_category()
only works with the default taxonomy, per the Codex page; you probably need to use get_the_terms()
instead.
So you’d replace your get_the_category()
call with get_the_terms( $post->ID, 'brands' );
, if I’m not mistaken.
Related Posts:
- Exclude a category from WP_Query
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- Show Post Count of a Category
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- Querying Term Posts in Loop
- Show custom post type filtered by category
- Custom post types and ‘new WP_Query’
- Variable not working in WP_Query
- How to Display Posts From Category Within a Custom Taxonomy?
- display posts of custom post type with custom taxonomy
- How to query Posts from a custom post type which contains a custom taxonomy?
- How to manage a dynamic multi-level page hierearchy system?
- Custom Post By Category
- Only show current category post
- Post Editor: display categories from current post type taxonomy only?
- Sort ACF by custom taxonomy
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Counting Posts of a Given Post Type Having a Specific Taxonomy?
- category__in not working on custom post type
- Displaying Posts Related to Other Posts by a Taxonomy Term?
- Querying Posts by Taxonomy From Alternate Network Site
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- Query for posts in 2 taxonomies
- Custom post type taxonomy template
- Paginated Taxonomy Term Archive including one post per term
- How do I create an archive page for standard posts?
- get_categories() for only CPT
- custom taxonomy archive by year
- Is it possible to create a shortcode that will query a post based on taxonomies?
- wp_query to find posts by year and month
- Custom Post Type Loop within Shortcode
- Weird problem happening with custom taxonmy when creating/updating posts
- Pagination on category page with custom post types
- How to add post_type=value when editing that post type in the WordPress admin?
- Display CPT posts based on specific taxonomy
- showing custom post types of a certain category only
- Filtering WP_Query Dynamically on the Front-End
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Show a Category X’s custom post type on Category X archive page?
- Get related posts of child term of custom post type
- Filter CPT posts by one or more categories
- Getting categories of posts under a custom taxonomy
- Custom WP Query on custom meta and sort by multiple meta keys value
- Custom taxonomies relationship
- WP Query with categories only shows one post and ignores the category
- How to edit this code to get the categories in achieve page?
- Get the category from custom post type
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- Prioritize posts in query by meta keys?
- WP_Query orderby and tax_query
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- WordPress wp_query() basic question about args
- How to add current custom taxonomy slug to body class
- Display posts of specific category term
- List Posts By Custom Taxonomy
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- WP_Query with custom post type ID
- The Difference Between Categories and Tags and Taxonomies and Terms
- How to get the post terms from a child taxonomy
- Post Query not working
- Get child categories of custom taxonomy category?
- Create query for both custom post type and category
- Different structure/content for posts from a custom post type
- custom taxonomy listing returns no posts
- How to fetch posts that are stored in the different table than (default) wp_posts?
- WP_Query order custom post type with certain meta key value by post modified date
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Am I mixing up the concept of posts pages and categories?
- how to organize my categories or should I do custom post types for some?
- Display featured posts for a custom post type by taxonomy
- What is the most efficient way to execute recursive complex queries?
- How to divide Subcategories into pages of parent category wordpress
- Display all Categories except ones with a specific parent
- Custom front-end form for adding post – Category problem
- have to do a while have post to show for two custom post types sharing the same taxonomy?
- How to search through all child taxonomies using WP_Query?
- minimize wp_query call to database
- Custom post Query and WordPress Post Query Clash
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Filter By Term Not Working – Custom Post Type
- Custom post type category archive URL redirects to home page
- Checking Taxonomy Terms for a Custom Post Type With get_the_terms Not Working
- WP_Query for CPT with filter by another WP_Query
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Display 2nd category, only once, as sub-heading, in the loop
- How to query posts by meta keys AND under specific category?
- Shortcode display CPT Query only showing 1 post?
- Query Only Show Text on Posts With Certain Taxonomy Tag
- Storing/querying custom date data
- Retrieving IDs of child pages which are in a different post type
- Query Posts From Multiple Post Types
- category_name not working in WP_Query
- Catergory args causing loop not to show
- Remove slug from Custom Category Permalink + dual-category permalinks
- How do I hide single category post on my post page
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- How to add categories to a custom post type using wp_insert_post($new_post);
- WP Query – Can’t get posts with specific taxonomy