Change:
get_the_category()
toget_the_terms( null, 'taxonomy_name' )
.get_category_link( $cat->cat_ID )
toget_term_link( $cat->term_id )
.get_category( $category->category_parent )
toget_term( $category->parent )
.
If you want to use the same function for multiple taxonomies, you can accept the taxonomy name as an argument and pass it to the first item above:
function display_cat_level( $level = 0 , $link = false, $taxonomy = 'category' ){
$cats = get_the_terms( null, $taxonomy );
// etc.
}
Also, even when working with categories, don’t use cat_ID
and category_parent
. Those were deprecated 11 years ago in favour of term_id
and parent
.
Related Posts:
- get_posts assigned to a specific custom taxonomy term, and not the term’s children
- Get the the top-level parent of a custom taxonomy term
- Custom taxonomy, get_the_terms, listing in order of parent > child
- Determine Term depth
- How to enable hierarchical permalinks for hierarchical taxonomies
- Get taxonomy name of current post
- Determine if Term has Grandparent/Great-Grandparent
- Custom Taxonomy Relationship (ex: plant classification)
- Custom Taxonomy Only Showing Top Level Terms in Admin?
- How to fix a double slash in custom permalinks with hierarchical taxonomy’s?
- How to include parent terms in hierarchical taxonomy URLs?
- How to set hierarchical terms to a post using wp_set_object_terms
- Help building array hierarchically with taxonomies (to get posts)
- Hierarchical display of custom taxonomy
- How to get parents of custom taxonomy, as what get_category_parents() do?
- Populating dropdown menu with hierarchical taxonomies
- Taxonomies: display hierarchical parent list
- Display hierarchical subterms of custom taxonomy based on depth
- Redirect all child taxonomy to its parent
- How do I display a list of posts under all hierarchical children of the current taxonomy?
- Register a pre defined tree of taxonomies
- How to make custom post taxonomy looks like regular categories?
- Hierarchical Taxonomy Terms Select Menu Output with selected=”selected” Set
- Custom Taxonomies not retaining hierarchy while importing from one site to another
- Rewrite rules for varying nested terms of custom taxonomy
- List Posts For Terms Of A Custom Taxonomy For Any Post Type
- Using custom taxonomies to display hierarchical URLs?
- how to store values in database at hierarchical view
- tax_query: Don’t show posts with parent term when they have a corresponding child term applied
- SEO Title Tag and Meta Description for custom taxonomy
- Need help understanding a rewrite with multi-level taxonomy
- Taxonomy term breadcrumb; how?
- Determine if Term has Grandparent/Great-Grandparent
- Getting grandchildren of a post with a specified custom taxonomy?
- List child terms and posts in the current term
- Display Parent and child taxonomies in seperate drop downs [duplicate]
- More than one Hierarchical Taxonomy and SEO
- Get term name from term ID?
- Can custom taxonomies be displayed inside of a custom meta box?
- Front End Post Save Child terms
- Display child taxonomy until the last child
- URL rewrite rules for multiple taxonomies query
- Page queried instead of a custom taxonomy
- Pros and cons of using [taxonomy name] in place of [category name]?
- How to display and use all existing tags at my write-post-at-frontend-panel?
- How to use create_term, edit_term, delete_term actions?
- Echo taxonomy term meta on author.php
- custom taxonomy archive permalink shows 404 error
- is there any limit of length on creating custom taxonomies?
- WPML Translating a term/taxonomy programmatically
- Display an image instead of tag name?
- Custom fields ‘for’ custom taxonomy?? Can someone explain why?
- Display Custom Post Type Taxonomy Child Categories and their Posts
- List taxonomies according to whether this post is in another taxonomy in taxonomy archive
- Taxonomy template shows only 10 posts
- Pagination on custom taxonomy
- Disabling wp_tag_cloud() outputting inline CSS
- How to show all possible parents and children of a hierarchical taxonomy term?
- Custom Taxonomy
- How to use taxonomy term as a value of get_template_part?
- Custom post type Permalinks with hierarchical Taxonomies
- How to change url for taxonomy pages?
- How to Modify Default Text in a Custom Taxonomy Admin Panel?
- Take a custom taxonomy value and save as a standard Product Tag
- Check If Taxonomy A and Taxonomy B has same Slug, 301 Auto Redirect Tax A to Tax B if True in WordPress
- Why isn’t the ‘no results’ being shown when a query returns no results?
- How to get_the_term_list() from multiple taxonomies?
- How to show post list based on taxonomy term?
- Display empty custom taxonomies differently than with one with posts
- Double slash in the_terms URL
- Using custom taxonomy when registering a new custom post type
- How to call a custom taxonomy term name inside a function?
- Get custom taxonomy name (not the term) in custom post
- remove term from custom taxonomy list
- Display taxonomy with a maximum number of letters
- query to use to link to taxonomy single page
- Display Child Categories of Current Post ID
- Taxonomies specific to Page attribute template
- Saving custom taxonomies to post as checkbox on frontend
- How can I show links for custom posts group by taxonomy current term and sub-term?
- Show custom taxaomy as a product meta
- Keeping session instance of random display results over pagination breaks
- Rewrite Search URL Permalink For CPT Custom Taxonomies
- Infinite Scroll appending Next Product Category Term pages
- Template taxonomy-{taxonomy}.php doesn’t show my posts
- Count tags for current post and save into custom meta field (and update it on post edit)
- Passing taxonomy id of taxonomy clicked on one page to another page
- Custom Taxonomy Not Being Recognized by is_tax()
- How to truncate the description in the admin panel for a custom taxonomy
- Custom button on custom taxonomy listing page
- customize taxonomy Page
- Why is it defaulting to “uncategorized” even after I select a custom taxonomy
- Remove taxonomy menu without removing the metabox?
- Custom taxonomy list in Worpdress
- How can I show custom field according to taxonomy?
- WordPress Taxonomy Menu
- Insert code on specific taxonomy archives
- get_term_children specific no id
- custom texonomy category child category list with parent head
- Gravity Forms with Advanced Post Creation Add-On not updating ACF fields on custom taxonomy