To get only the parent terms you have to use the argument parent and set lvl 0.
From codex:
If 0 is passed, only top-level terms are returned. Default is an empty
string.
$terms = get_terms( 'tagportifolio', array( 'parent' => 0 ) );
See another question and answer here: How can I get only parent terms?
Related Posts:
- Include custom taxonomy term in search
- List all the tags from a custom post type
- Are custom post types lost when the theme is changed?
- How to Make a Separate RSS Feed for Each Custom Post Type
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- custom post type taxonomies UI radiobuttons not checkboxes
- Custom Post Type Archive Template
- Order posts by (hierarchical custom) taxonomy terms and term children
- Filter get_categories() for taxonomy term in WordPress
- Custom search for custom post type, custom meta and search fields
- Posts per Page on custom Taxonomy Template
- Display CPT taxonomies as an archive page
- How do I list terms of a custom taxonomy at i.e. domain.com/brands/
- Permalink Structure problem with cpt and custom taxonomy
- Taxonomy-{taxnonomy}.php is not working
- Auto Draft Specific Categories Posts after a certain number of Days
- Custom Taxonomy 404
- Custom Post Type Query multiple Taxonomy Terms
- How to add custom fields to admin UI and REST API response?
- Custom Post Type: Linking Terms to show Count
- Custom Permalink for Taxonimie and Custom Post Type
- WordPress tax_input only if logged in
- Taxonomy Url with Custom post type prefix re-write rule
- How to filter the taxonomy terms based on another taxonomy term
- How to sync tags between posts that are linked through Posts 2 Posts?
- Custom Post Type with two hierarchical Custom Taxonomies: strategy to generate best permalink structure
- Combining custom post type and post category
- how can i get posts from custom post type particular taxonomy category
- Conditionally custom post type url rewrite
- get_the_terms return only last term
- How do I get array of types associated with a taxonomy?
- Root slug of taxonomy returning 404
- wp_get_post_terms on custom post type with custom taxonomies returning an empty array
- Pagination for Custom Taxonomy Page [duplicate]
- get_category_parents for custom post type taxonomy
- Custom loop with multiple taxonomy queries
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Hide post navigation if current post is in a category with only one post
- Setting up taxonomy to relate various custom post types – advice on structuring?
- I want to change the word “Tags” in WordPress to something else, but how?
- What is the best practice for displaying my plugin content in themes?
- Set post terms for multiple posts
- Get terms that contain posts that in turn belong to other terms?
- Archive for a Taxonomy of a Custom Post type
- Pagination Not Working for Custom Taxonomy with Custom Query – 404 Error
- Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink
- Querying two taxonomies with tax_query not woking
- Shared terms between taxonomies
- custom hierarchical taxonomy and custom post type list contains surplus posts
- Custom sidebar for custom post type
- Show category and tag link as a submenu under custom post type submenu
- Urls in Custom Post Type work for Terms but not for its Taxonomies
- Add filter to Admin list for all custom post types by their custom taxonomies
- Single.php for Custom Post Type > Taxonomy > Term
- Add the custom post term to the custom post title
- Display 3 recent posts from one taxonomy
- Display next 3 posts based on custom taxonomy
- Displaying custom taxonomy menu in custom post type archive
- Custom post types templates
- Related “custom post type” using “custom taxonomy”
- How to create Custom Taxonomy Search Drop Down for specific Post Type
- Can I set the post_type query_var as a link is clicked?
- How to have multiple search result pages in wordpress with taxonomy terms listed
- Remove cpt slug from url and use custom taxonomy instead breaks all other cpt
- Set priority to permalinks
- How to properly set the rewrite rules for this case?
- Assigning categories to custom post types via a front-end form; only works for native post type
- How to list posts by terms
- Changing CPT permalink
- How to fix 404 on post after prepending Custom Post Type url with Custom Taxonomy Term slug
- Custom post type structure + permalink structure
- WP_Query based on ‘s’ and tax_queries
- List all posts associated under custom taxonomy
- Custom post type and taxonomy same slug
- How to structure a website with custom post types and custom taxonomies?
- Custom post type category link + add to menu
- Single taxonomy for different custom post types
- The most recent post of custom taxonomy
- Display a Custom Post Type within another with hierarchically slug
- Problems with the WP_Query query for a Custom post type
- I want fetch custom post with taxonomy id
- Decrement term in for each
- Display Taxonomy Term for CPT on single-CPT.php
- WordPress custom post type advise
- Custom Post Type and Taxonomies, creating the corresponding template file and loop the data
- Custom post type taxonomy not sorting correctly
- Post data in separate divs with incrementing class using WP_Query
- Custom Taxonomy List, Selection floats to top
- Get term_id for each instance of custom taxonomy
- Customize category URL
- Permalink Trouble with Custom Post Type
- How to internationalize the sub menu name “categories” in Custom post type?
- How to list groupings and keep pagination
- Custom Post Types and Taxonomies
- install.php Custom Taxonomy Term not being added to custom post
- How to retrieve taxonomy terms of the current custom post?
- Custom post type with new taxonomy [duplicate]
- Custom post type / Filter by letter
- trying to display custom post type with custom taxonomy value by shortcode can’t works [closed]
- How can I show second most recent post in sidebar, if most recent post is open in the browser?