Your CPT and your CT init seem to be right, but the way you get the taxonomy terms is incomplete.
If you look in WordPress Codex, the function get_terms(); accepts two parameters:
- $taxonomies
- $args
If you want to get only parent terms you have to specified it in your $args array.
$args = array(
'parent' => 0 // queries only top level terms of a specify taxonomy or taxonomies ( first argument, rememberer? )
);
So in your case, try this:
<?php
$taxonomy = 'btp_work_category';
$terms = get_terms($taxonomy, array( 'parent' => 0 ) ); // Get all top level terms of a taxonomy
if ( $terms && !is_wp_error( $terms ) ) :
?>
<ul>
<?php foreach ( $terms as $term ) { ?>
<li><a href="https://wordpress.stackexchange.com/questions/172109/<?php echo get_term_link($term->slug, $taxonomy); ?>"><?php echo $term->name; ?></a></li>
<?php } ?>
</ul>
<?php endif;?>
Hope it’s helps!
Related Posts:
- WP_List_Table Inside Metabox Not Working on Submit
- Showing current taxonomy terms
- Custom permalinks – post type – hierarchical taxonomy’s
- automatically create taxonomy with same name as post title
- Display taxonomy term only if there’s a value
- Adding Custom Taxonomy to WordPress default Post type
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- Making pages also serve as taxonomies? Or give full pages to taxonomies?
- get_queried_object error How to show post count by month in the taxonomy page
- How to filter the taxonomy terms based on another taxonomy term
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- Show Two custom Post type and their posts on category page
- Missing Posts in Custom Taxonomy List
- Disable block with taxonomies at post page
- Which post does a taxonomy term belongs to?
- List custom taxonomy specific to one custom post type
- Get related posts of child term of custom post type
- WP the_posts() on single-cars.php get category link
- 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?
- Copy/Move selected taxonomy terms to another taxonomy for posts
- Different structure/content for posts from a custom post type
- List all posts in taxonomy term
- custom taxonomy listing returns no posts
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Search CPT by tag ids
- Post template with breadcrumb needs to show page navigated from
- What is the best way to structure posts for the same event happening in different years?
- Right way to store a large set of similar information on website? [duplicate]
- Define multiple prefixes for custom post type
- I cannot display custom posts in custom taxonomy
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- How to manage a dynamic multi-level page hierearchy system?
- How can I get the last 5 element of this tax query?
- Display title of all custom posts from same taxonomy term on a custom post template
- How to get all posts related to a taxonomy?
- Filter By Term Not Working – Custom Post Type
- Custom Post Status & Taxonomies
- Post Editor: display categories from current post type taxonomy only?
- Linking custom taxonomies and posts
- How to Associate Posts with Pages
- Query Only Show Text on Posts With Certain Taxonomy Tag
- Custom My account page and custom page for editing posts
- Automatically add custom taxonomy when meta value gets to a set number or beyond
- Sort ACF by custom taxonomy
- How to develop Knowledge center in WordPress Website
- Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?
- Why does my custom taxonomy show a total count across all post types
- Limit the post for differents custom post type in the same wp_query
- Custom Post Type with Nested Taxonomy and Template Files
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- 404 error PageNavi custom type taxonomy | wordpress
- Display Custom Post Type in Recent Posts
- Query for posts in 2 taxonomies
- custom taxonomy archive by year
- Can custom taxonomies items have attached properties?
- Custom Taxonomy URL are redirecting to page with the same name
- Loop custom taxonomy to get lists of cutom post types?
- Hierarchical Custom Post Types in Array
- Making certain categories of CPT not publicly queryable
- Show a Category X’s custom post type on Category X archive page?
- custom-taxonomy/post_name instead of the default post_type/post_name
- Custom taxonomies relationship
- Display post content with respect to its title?
- Load Next Posts With AJAX not working with custom post type
- Custom Taxonomy not being saved on custom posttype
- Get parent category id from child category page for custom taxonomy
- Trying to get custom post of a custom taxonomy
- How to get only child terms from a custom taxonomy of current post type?
- How can I create an automatic drop down menu with my tags?
- Get taxonomy singular name instead of taxonomy slug inside $taxonomy query
- sort CPT on Custom Taxonomy Archive page
- wordpress lists similar type of posts in a custom post type
- Cannot choose custom categories for custom post type in post editor
- Modifying rewrite rules to use /category//
- Custom Post type Query by Taxonomy
- Custom post not appearing under custom taxonomy category
- Order custom posts by taxonomy, then by meta_key
- Safe to throw 404 error in request filter?
- How to select custom posts thats are tagged with multiple taxonomies using wpdb
- How is possible to know ID of taxonomy-{taxonomy}.php page for ACF fields
- Limiting the Number of User Posts to Their Own Posts
- Aloha! VERY broad CPT questions. Looking for the theory/best practices behind it
- Dont know why my custom post type not add_post_meta
- Custom post type single with custom URL structure
- WordPress custom post type taxonomy paging
- News post with multiple permalinks? When opened from different page
- List posts that have the current url taxonomy
- wordpress does not see the correct custom taxonomy hierarchy
- Rewrite url post_tag for custom post type
- How to build overlapping custom post_type and taxonomy rewrites without conflicts?
- Generating a radius search on postmeta-metavalue and adding a taxonomy to query
- WordPress Author Posts Review After Every Change In The Same WordPress Post
- Changing custom taxonomy’s slug as required?
- Archive custom template from search
- Changing checkbox array from single to multiple select
- How do I hide single category post on my post page
- Links in archive not including taxonomy parameter