I’m not sure what you mean by ‘first’ taxonomy… but,
$terms = get_the_terms( $post->ID, 'mytaxonomy' );
returns an array of taxonomy term objects, so
$term = array_pop($terms);
Would give you the first term in the array. And then:
echo '<a href="'.get_term_link($term->slug, 'mytaxonomy').'">'.$term->name.'</a>,'
(You may want to include some if statements, in case an empty array or error is returned (see is_wp_error
)
Related Posts:
- How to change permalink structure for custom post type and it’s taxonomies?
- Creating “static” taxonomies to choose from, inside custom post type?
- How can I list all the categories under a Custom Post Type (taxonomy)?
- How to list all categories and tags in a page?
- How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?
- How can you make permalink work for custom post type and taxonomy?
- How to get a list of term names of the custom post type im currently on in single.php
- List all custom post type posts from a given category?
- Custom post type taxonomy template
- get_categories for custom post type and filter by custom taxonomy (brand) and list child categories of a defined category
- Category page only displaying the posts from a custom type
- Show Post Count of a Category
- Custom Post Types and Categories?
- How to create new category for custom post type?
- Get Post Primary Category
- Pagination is not working on single-{slug}.php but works fine on page-{slug}.php
- How to get the post type from a category id?
- How to show CPTs in term archive
- Display all posts in main category and 1 subcategory
- Show category ID on custom post type
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- Limit amount of posts made within a custom taxonomy
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Categories and tags for custom post types
- get_category_link() for custom post type does not include custom slug rewrite?
- Targeting categories in custom fields
- Invalid Taxonomy
- Need help deciding on a taxonomy
- Get Posts by Category, Tag , and CPT Taxonomy
- Get assigned post categories
- Default Category Page not showing custom post type which has taxonomy category
- Categories won’t appear on custom post type
- Custom Post Type with modified permalink structure results in 404
- Custom post type, taxonomy and admin bar
- Displaying taxonomies as category links within sidebar and creating pages for these
- Custom post type archive page filters
- How to show related posts of category on post within custom posttype
- get taxonomies from terms
- Create custom post type categories
- Set a Default CPT taxonomy by taxonomy id
- how to create custom taxonomy drop downs for parents and child
- How to manage a dynamic multi-level page hierearchy system?
- Categories manage
- I can not call the categories of custom post type
- Reuse the “category” slug for a custom post type
- How to create groups like that in buddypress?
- Update Cateogory Taxonomy Count for Attachment Post Type
- Best way to structure article and issue relationship for CPT
- Custom Post Type used for FAQs Accordion
- category_name not working in WP_Query
- How can I set up the URL for a category archive for a custom post type?
- Custom Post Type order Title ASC
- show only one category posts in admin
- Is it possible for post and custom post type to share a category base slug?
- Add Category Taxonomy Support to Custom Post Type
- WP_Query ignores post_type in category view
- Is there a way to use regular categories with custom post types?
- Structuring a product catalogue in WordPress [closed]
- Get list of terms of current taxonomy archive for another taxonomy
- WP_Query with custom post_type and cat retrieving unwanted posts with the custom posts
- Showing Custom Content in a Nav Dropdown
- Menu Multiple Taxonomies
- How to make a custom taxonomy selectable in post publish area?
- Create Custom Post Type Permalink Structure
- Filter categories of posts with checkboxes
- Custom page template for category taxonomy
- How can I display an archive of only one category of my custom post type?
- Custom post type getting wrong categories and tags
- How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?
- Custom Post Type and Category Base Rewrite Issue
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- WP the_posts() on single-cars.php get category link
- Displaying Custom Posts
- How to include category name/id in wp_query for retrieving “custom post type” from a particular category?
- Custom Post Types not queried in Custom Taxonomy archives or Native archives
- Include custom post type custom taxonomies in Categories widget
- Remove categories taxonomy from custom post type
- WordPress custom post categories and subcategories on category.php
- Changing CPT slug and taxonomy already registered in parent theme
- Use post in multiple places on a page with multiple posts
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- Custom post type specific category box
- Custom Taxonomy Taxonomies of Same Name point to first created URL
- category.php not showing custom post types
- Menu for taxonomies and posts belongs to taxonomy
- How to automatically create a terms based on each post of a post type
- Custom taxonomy returns 404 even with saving permalinks
- Get name CPT with slug taxonomy
- Add other all taxonomies as meta boxes to custom post type
- Getting list of Categories for Custom Post Types
- get children from current variable (taxonomy) via shortcode
- Exclude categories For Custom post types
- List all posts from custom post type by taxonomy
- I have a custom post type that I want to query a dynamic category name from a custom meta field
- Get all active posts that are tied to a custom taxonomy for a custom post type
- Custom Post Types Permalink
- How to add categories to a custom post type using wp_insert_post($new_post);