You can use the count
property of the taxonomy term and if it is > 1
, then show the term linked to archive.
// inside loop, get the terms of a custom taxonomy for the current post
$terms = get_the_terms( get_the_ID(), 'your_custom_taxonomy' );
// cycle the terms and display the name, linked to archive if term count is > 1
foreach ( $terms as $term ) {
$link = $term->count > 1 ? get_term_link( $term, $term->taxonomy ) : FALSE;
echo '<li>';
if ( $link ) echo '<a href="' . $link . '">'; // open link if needed
echo $term->name; // always show term name
if ( $link ) echo '</a>'; // close link if needed
echo '</li>';
}
Related Posts:
- List all taxonomy terms / Show links if posts are attached, else names
- How to use a Term Meta Field as a link
- Is There a Difference Between Taxonomies and Categories?
- How to show a hierarchical terms list?
- get_terms by custom post type
- Need a simple but complete example of adding metabox to taxonomy
- Get Posts by Custom Post Type ,Taxonomy, and Term
- Get parent page url to show up when it is in child pages
- Why is there a link tag with rel “profile” pointing to gmpg.org?
- Check if a post is in any child category of a parent category
- How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms
- How to use wpLink without editor?
- Add CSS Class to Link in TinyMCE editor
- How to print translation supported text with HTML URL
- How can I create a taxonomy meta-box with search suggestions but no new terms input?
- Get the prev / next page links only (not title, etc)
- tax_query in get_posts() not working?
- What is wp_insert_term “alias_of” arg for?
- Automatically Assign Parent Terms When A Child Term is Selected
- Control term order on a per-post basis
- get term by id without taxonomy
- How to re-enable the links manager?
- How to limit the number of terms (terms acts like categories)
- Wondering how to turn your firefox bookmarks into a WordPress blog?
- How do I list custom taxonomy terms without the links?
- get a specific taxonomy term name
- Exclude specific slug in ‘get_terms’
- How can I link to the most recent post in a category?
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- wp_set_object_terms() Fails to Set Terms
- Is there a way to disable a term rather than deleting it?
- Links redirecting to localhost after migration to server
- wp_insert_term doesn’t work with custom post type’s taxonomy
- Is it possible to link to draft pages?
- Modify Term Update Redirection
- How can I find all internal links that are pointing to post/page?
- List Hierarchical Term List with Count with Related Term
- How can I select a primary category?
- How are terms connected with posts in database?
- show tags of custom post type ONLY
- Is there a way to set singular/plural labels for taxonomy term names?
- Return only the custom sub-term for custom post type, do not echo term-parent
- get_terms() How many is TOO many?
- Check if current term is a child of another term
- Count posts that have specific taxonomy term attached
- Retrieve single term slug
- get_terms() doesn’t return empty terms even though hide_empty is false
- Why is my WP_Query not working when tax_query terms are an array?
- get_terms with posts that have a different taxonomy with term x
- Formating the_terms() function output
- Creating a Link Directory using WordPress?
- Count and show Clicks on external links in a single page/post
- How to use wp_rel_nofollow to add nofollow to external links only?
- get_category_link() is returning nothing
- How to add terms to taxonomy with wp_insert_terms?
- Get_term_by only returns one item from array
- Custom Taxonomy Only Showing Top Level Terms in Admin?
- Taxonomy terms with edit/filter link in wp-admin, in the list of custom posts
- display multiple term post from taxonomy in a single page
- How to find objects by terms
- Can we have same term slug in different taxonomies?
- Is there any difference between post in child term and child & parent terms?
- Get current term’s ID
- Using get_terms for custom taxonomy in functions.php
- Is it possible to get a Previous/Next Taxonomy term archive URL?
- How to associate an image with a term taxononmy and publish it on frontpage?
- get_post_terms not working as expected
- Is there any way to set default for “Insert/Edit Link” to “Open link in new window”?
- get_terms return errors
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- root-relative links for multiple parked domains
- Get link value only from the_content()?
- Create and move terms for taxonomies
- How to splice in wp_links links into the loop?
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Display certain amount of posts on taxonomy archive page
- have_posts() return false but count says “3”
- Importing data from spreadsheet into wordpress DB, along with custom taxonomies and their terms
- How to get the top most term (top ancestor) of a custom taxonomy child term?
- widget to output a link to archive view
- Missing term_id and term_taxonomy_id when adding a term using wp_insert_term() function
- How to set hierarchical terms to a post using wp_set_object_terms
- Echo taxonomy term meta on author.php
- I want to remove the links from the term list returned by get_the_term_list
- Hierarchical display of custom taxonomy
- Is there an easy way to create a links index page?
- Can’t add a class to links in the visual editor since WP 3.1?
- How to get the last term from taxonomy?
- Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Count posts for each taxonomy term for each month
- Get posts that matches specific terms of multiple custom taxonomies
- List post from current taxonomy children
- What hooks/filters are there to alter selected terms on post save?
- Count argument in get_terms has no effect on ouput/doesn’t work
- Get list of terms of current taxonomy archive for another taxonomy
- How to display term description in empty terms archive?
- What is the canonical way to link to pages?
- How can I remove links from the function “get term list”?
- Fast way to add countries as a custom taxonomy term?