A little bit more involved but:
<?php
function get_single_term($post_id, $taxonomy)
{
$terms = wp_get_object_terms($post_id, $taxonomy);
if(!is_wp_error($terms))
{
return '<a href="'.get_term_link($terms[0]->slug, $taxonomy).'">'.$terms[0]->name.'</a>';
}
}
//example
echo get_single_term(5, 'category');
Related Posts:
- Remove taxonomy base or term from url
- Can custom taxonomies be displayed inside of a custom meta box?
- Bulk term assignment for attachment taxonomies
- Why is my working Custom Taxonomy not in get_taxonomies array?
- Custom taxonomy listing page when no term set (all terms)
- Display child taxonomy until the last child
- Taxonomy slug by term ID
- How to enable hierarchical permalinks for hierarchical taxonomies
- Exclude Child Term Posts from Parent Term Archive
- Create taxonomy with meta term using the WP Rest Api
- Use custom posts as taxonomy term meta replacement?
- Best practices for complex taxonomies
- wp_get_object_terms – How can I order the resulting array by hierarchy?
- Remove description in custom taxonomy edit screen
- Taxonomies not appearing in columns on dashboard
- How to output the taxonomy term name in a widget
- Make Custom Taxonomy Category Use Parent Template
- custom post type category page
- Advanced custom fields – taxonomy terms images [closed]
- How to call custom taxonomy categories with shortcodes
- How to get terms of a custom post type in a loop inside footer.php
- Is It Possible To Have Shared WordPress Custom Post Types?
- How can I display all post IDs from the taxonomy?
- Woocommerce custom taxonomies page
- Allow only 1 instance of each term in each custom taxonomy
- Outputting an array of term meta values in a custom WooCommerce tab?
- Get terms from posts submitted within a certain time
- Storing an array using update_metadata [closed]
- Display Terms for all posts in Current Archive or Query
- Display post taxonomies tree
- How can I add buttons to a custom column in the taxonomy table?
- WP_Query on custom taxonomy works fine but fails if run through wp_ajax_
- JSON API – search by custom taxonomy
- Advanced Query Logic With Multiple Taxonomies
- 404 error- issues with pages after adding custom rules for posts
- Wrapping result of the_terms in a span with a class of the term name
- Pull in taxonomy links using get_the_terms?
- Adding content to a taxonomy metabox
- Howto control custum taxonomy order?
- I am trying to display information from a custom table from my wordpress users pages
- Save custom taxonomy data in different table not in wp_options for my own plugin
- Retrieve Custom Taxonomies according to posts selected
- Redirect on saving term at custom taxnomy
- Different single page templates for taxonomies
- Can I use OR relation for one item when calling tax_query from WP_Query and use AND for the rest?
- Pagination on Custom Tax Pages Removes Spaces from Query Vars
- Taxonomy Rewrite Rules Redirecting Instead of Masking
- get_terms not returning any custom taxonomies
- I don’t need ‘view’ page for my custom taxonomy
- WordPress implode & wp_insert_post question
- Use the same taxonomy twice on the same post type?
- How to write sql query to get the posts from a custom taxonomy term name
- How to do a particular wp_query taxonomy search
- How to display a custom taxonomy without a link?
- Get post count for current custom taxonomy
- Build filter for post-type + multi taxonomies + multi terms
- get_term_by works but get_terms doesn’t?
- Get custom taxonomy name (not the term) in custom post
- How to add custom content to custom taxonomy
- How can i add custom field inside custom post taxonomy?
- Fix Custom Taxonomy Display two times on each call
- Update Custom Taxonomy Value for a post based on custom date field
- How to output taxonomy term (incl. link to archive) on author.php?
- Featured Images for Tags?
- Taxonomize taxonomy terms?
- displaying posts from a custom post type tags
- Showing relevant categories on custom taxonomy template
- How can I show links for custom posts group by taxonomy current term and sub-term?
- Show custom taxaomy as a product meta
- Taxonomy page loading wrong data
- How to use custom slug and custom templates for custom taxonomy?
- Updating a custom post type’s custom taxonomy in a custom editor block
- Conditional if is single and part of the custom taxonomy
- how to show product custom taxonomies in woocommerce rest api
- Auto add custom taxonomy to permalink when save
- Custom taxonomy – no posts found
- WP Tax query & order by tax query not working
- Show latest used taxonomy in homepage
- Link a page from admin to a custom taxonomy
- What’s the url queryvar for a taxnomy archive?
- set_object_terms for custom taxonomy in custom post type – not working
- Custom button on custom taxonomy listing page
- Custom Taxonomy Archives Page Errors
- Permalink Rewrite to include Custom Taxonomy Term
- Remove taxonomy menu without removing the metabox?
- Custom taxonomy list in Worpdress
- Where is defined a custom register_taxonomy? [closed]
- Differentiate Parent & Child of Custom Taxonomy
- Listing all selected terms for custom taxonomies on a post
- Multiple Taxonomy in URL/Query – No Custom Post Type
- Calling Custom Taxonomy Dropdown in Form
- Displaying Custom Taxonomy List Posts By Slug?
- Show different sidebar on taxonomy pages when a default is set
- Taxonomy Extra Meta [duplicate]
- How can I get parent term from a child term
- Custom Taxonomy – Archive for the whole Custom Taxonomy (and not just single term)?
- get_terms() – unexpected ‘=>’ (T_DOUBLE_ARROW) error
- ACF Display Taxonomy Image Field
- Guest author – URL, base and custom taxonomy – working but unstable
- Search and filter with custom field in taxonomy