You can use get_queried_object
to return the full queried term object on a taxonomy archive page.
$term = get_queried_object();
if( 0 === $term->parent ){
// term is top level
} else {
// term has parent
}
Related Posts:
- Include and Exclude Taxonomies From Archives & Feeds Using ‘pre_get_posts’
- Check if current term is a child of another term
- How to hide custom taxonomy archives same way as hiding custom post types?
- How to pass posts_per_page and paged params query vars to custom taxonomy archive urls?
- Page queried instead of a custom taxonomy
- Using a different template per Custom Taxonomies for single term archive pages
- Creating an Archive using a Custom Taxonomy
- Display direct children of the current custom taxonomy in taxonomy.php template
- Date archive permalinks for custom taxonomy
- Taxonomy archive showing no results
- Dynamic loading of Archive content based on custom taxonomy term name
- List taxonomies according to whether this post is in another taxonomy in taxonomy archive
- orderby meta_value breaks taxonomy term archives
- Why is the custom taxonomy archive page redirecting me to a single post? [closed]
- How to have two different versions of a tag/category/taxonomy archive page?
- Automatically Give All Custom Post Types a Pre-Set Category [duplicate]
- How to add Post Format Taxonomy Archive page in the menu?
- How does WordPress Parent-Child Taxonomy actually Works?
- Custom taxonomy archive shows 404 error
- Custom Taxonomy index/archive hierarchy
- Filter custom taxonomy archive posts by 2nd custom taxonomy using select dropdown
- Custom Taxonomy Term Archive Page Template that Filters 2 or more Taxonomies
- How to use multiple archive templates for a taxonomy?
- how does the wordpress rest API work
- Taxonomy archive template that shows posts from more than one taxonomy
- Custom Taxonomy List with Children
- why the archive of custom taxonomy term shows nothing?
- Can I output a custom taxonomy as a submenu in the site navigation menu?
- Add terms to a taxonomy archive from within the same taxonomy
- Custom Taxonomies Archive Page 404
- How to create archive pages for metadata query generated posts (so without taxonomy)?
- How to create a completely functioning separate archive for posts from only 1 or 2 specific categories
- How to pass posts_per_page and paged params query vars to custom taxonomy archive urls?
- Hierarchical taxonomies in permalink cause 404 for sub term archive
- How to get a terms and posts associated with another term?
- Change the Page Title of the Archive Page for Portfolio Tags
- Custom taxonomy return 404
- What’s the url queryvar for a taxnomy archive?
- Multi level archive
- Custom Taxonomy Archives Page Errors
- index.php Not Showing Custom Posts / Terms
- Redirect or Prevent Viewing of Custom Taxonomy’s Archives?
- Creating a Taxonomy Page [duplicate]
- Exclude 2 in 3 terms of A Taxonomy from all Archives
- Insert code on specific taxonomy archives
- Permalinks not working on MU network with domain mapping
- Custom Taxonomy Archive URL rewrite
- Can you orderby slug in a taxonomy archive page using WP_Query?
- More than one Hierarchical Taxonomy and SEO
- Getting Catategory / Taxonomy Description on Non-archive Pages
- Taxonomies starting with a hyphen (minus) to assign B.C. dates to a post
- Custom taxonomy archive empty
- Why my archive title isn’t showing?
- Creating a custom archive page for WooCommerce products based on tags
- Altering the appearance of custom taxonomy inputs
- Adding An Image To A Custom Taxonomy Term
- Pagination throws 404 error on custom taxonomy archive pages
- Post Formats in the context of the Database ‘Save Post’ function
- Dropdown: Display terms from B only if has relationship with a term A selected
- How do you add custom taxonomy capabilities exactly?
- Adding Custom taxonomies to Press This panel
- Taxonomy page lead to 404 page on pagination
- Excluding a custom taxonomy term breaks wp_get_post_terms
- Can I turn off write-in tags/taxonomies?
- How to get Custom Taxonomy ID from the post ID
- Solve product properties with custom taxonomies?
- Permalinks for custom taxonomy stopped to work
- get_category_link returning page URL
- Getting associated taxonomies
- Custom taxonomy not appearing in menu administration panel
- how can i display taxonomy instead of category on my web page?
- Taxonomy Meta Box in User Profile?
- How can I make front page to display custom taxonomy page?
- How to show post list based on taxonomy term?
- WordPress autocomplete search with taxonomies
- Display empty custom taxonomies differently than with one with posts
- remove term from custom taxonomy list
- Display taxonomy with a maximum number of letters
- Display Child Categories of Current Post ID
- Custom taxonomies registered via plugin stop existing after function finishes running
- Echo ACF taxonomy field within a foreach for another taxonomy
- How can I rewrite the URL of my custom taxonomy to include the year?
- Infinite Scroll appending Next Product Category Term pages
- Listing Cities A custom taxonmy by selection order
- Problem registering custom taxonomy
- Limit Tag Links in Post Content
- Passing taxonomy id of taxonomy clicked on one page to another page
- Custom Taxonomy Not Being Recognized by is_tax()
- Custom taxonomy page template name and how to use it?
- Conditional Logic Based on Custom Taxonomy
- How to get name of custom taxonomy
- How to save custom taxonomy archive as a page template?
- Display the first tag assigned to a post
- Sorting Custom Taxonomy in ASC/DESC order?
- Order posts by month – in custom taxonomy template
- Are taxonomy hierarchies possible?
- Filer taxonomy posts by current category
- Nested Accordions For Taxonomies [closed]
- Add text in custom taxonomy
- How do I check if a post has a term with a particular ancestor/parent?