This is more PHP than WordPress, but wp_get_post_terms
returns a numerically indexed array, so all you need is basic PHP array syntax to grab the first item.
$terms = wp_get_post_terms($post->ID, 'custom_cat');
print_r($terms[0]->name);
You don’t specify which item you want. This will get you last item:
$terms = array_pop($terms);
print_r($terms);
Related Posts:
- get_posts assigned to a specific custom taxonomy term, and not the term’s children
- How can I get only parent terms?
- How to add images to taxonomies?
- Read-only taxonomy (user can assign term but can’t create or edit existing terms)
- Can you add the visual editor to the description field for custom taxonomies?
- Adding Category/Tag/Taxonomy Support to Images/Media
- get_terms does not return any results for my custom taxonomy?
- Order terms by term_order
- Large taxonomy (2000+ terms), causing WordPress to hang
- How to display warning on post editor when trying to add new term to custom taxonomy?
- How do you remove a Category-style (hierarchical) taxonomy metabox?
- Is it possible to have a taxonomy archive that lists taxonomy terms?
- Check if current term is a child of another term
- Is there a way to import terms into WordPress?
- get_terms() doesn’t return empty terms even though hide_empty is false
- You are not allowed to manage these items – bug introduced in 4.4
- Custom metabox for menu administration page?
- Remove Custom Taxonomy Base
- How to pass posts_per_page and paged params query vars to custom taxonomy archive urls?
- Exclude Custom Taxonomies
- How to get the top most term (top ancestor) of a custom taxonomy child term?
- Get custom category name from ID
- Retrieve custom taxonomies
- why do drafts return as part of wp_query?
- Populating dropdown menu with hierarchical taxonomies
- Taxonomy archive template to have conditional logic for displaying child categories
- How can I allow a custom taxonomy for certain roles?
- How to order a list of taxonomy terms alphabetically?
- Reverse traversing taxonomy based on term_id
- Specifying a size when displaying an image associated with a taxonomy through ACF
- Custom user taxonomies fail when i register multiple taxonomies
- Top level parent taxonomy ID
- Date range filter for manage posts list on edit.php
- Taxonomy archive showing no results
- Autogenerate Front End Form Field With jQuery
- Get posts by term slug only
- Changing taxonomy term by slug (wp_update_term)
- Selecting all posts from the children of a particular parent taxonomy
- How do I create a custom archive page depending on the custom taxonomy type?
- Display related products based on 2 specific product attributes values in WooCommerce
- How to Rewrite Taxonomy URL to Include the Post Type as the Second Segment of the URL?
- Add Custom Taxonomy for Blog Meta Info
- Include parent and child in category url
- How to get all taxonomies which can be added in menu?
- WordPress Tag or Custom Taxonomy Return All Posts if has that Word in Post Title
- Assign terms to new capability for all taxonomies
- Widget Logic use with Custom Taxonomy
- Select multiple categories from CPT to display in LayersWP builder widget
- Display value of custom field of custom taxonomy in single post?
- Custom Taxonomy and Rewrite URL
- limit post by a taxonomy in the admin
- WordPress Custom post query sorting does not work
- group posts by taxonomy terms
- How to create a custom taxonomy using a shortcode?
- Custom URLs in Custom Search Results
- Output unique taxonomy terms of posts inside a loop
- how to extract the username of the wordpress user?
- WordPress set taxonomy on post?
- How to find taxonomy parent id from child taxonomy page?
- Removing “trashed” posts from post count in custom taxonomy terms?
- How to remove the search field in custom taxonomy ui?
- How to add hierarchical taxonomy with parent child relation to URL?
- Best way to redirect taxonomy terms to pages
- WordPress cannot find user taxonomies on frontend
- Taxonomy archive template that shows posts from more than one taxonomy
- Hide echo of no categories from get_object_taxonomies
- How to get the term description in a taxonomy term archive query?
- Chaining Taxonomy Queries
- Drop-down filter doesn’t retrieve custom taxonomies
- How Can I Remove Child Slug From Grandchild Slug When Using Duplicate Grandchild Slugs?
- How to filter and/or sort user taxonomy query inside custom user taxonomy archive page?
- Admin only taxonomies?
- new custom filed not showing in taxonomy
- Rewriting url for multiple Taxonomies and Custom Post Type
- Why is the category item count not updating after assigning a category?
- Add custom taxonomy for post using cron job
- Dropdown (with onChange) with custom taxonomies
- Custom column into custom taxonomy (img tag with slug-name as file name)
- ACF Custom field not showing in Timber Taxonomy page
- How to get a terms and posts associated with another term?
- Displaying subcategories and then posts in taxonomy template
- How to use two same taxonomy in same post differently?
- How to show one post content in another post content which has same terms?
- How to set “manage categories” capabilities on a post type taxonomy but not on the general categories?
- Custom taxonomy name not being translated in post manager page
- Include attachments with a custom taxonomy in search
- Can I use multi (sub) levels of relation (AND | OR) on custom query?
- Avoiding stripping of HTML in Custom Taxonomy Meta Field
- Advanced AND tax_query in sidebar with 2 taxonomies
- How to update WordPress custom SQL Select query for custom taxonomies so that syntax is correct?
- Display term description on hover using get_the_term_list
- Alternative for is_taxonomy() to workaround theme’s default sidebar
- Can I use get_term_children to show child terms if they exist and show something else if they don’t?
- Displaying the custom taxonomies side by side on the admin dashboard
- Display woocommerce product_cat child terms with thumbnails
- Head Code for Custom Taxonomy
- How to add a custom page template selector to a custom taxonomy?
- Adding new terms to custom taxonomy
- List posts grouped by children of a custom taxonomy
- Hide empty categories on widget