Inside your foreach
loop you’re overwriting the value of $termlinks
before you ever output the previous one:
foreach ( $terms as $term ) {
$termlinks = get_term_link($term,$taxonomy);
}
All that code will do is ensure that $termlinks
is set to the last term in the $terms
array.
It also means that when you finally output $term->name
it will be the name of the last $term
in the loops.
If you want to output for each of the terms you need to move the output to inside the loop:
foreach ( $terms as $term ) {
echo '<a href="' . $termlinks . '">' . $term->name . '</a>';
}
Related Posts:
- Full Custom Post Type List Organised by two Taxonomies
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- List all posts associated under custom taxonomy
- Looping taxonomy in taxonomy?
- Get all active posts that are tied to a custom taxonomy for a custom post type
- How to Filter the Custom term loop based on dropdown
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- List custom taxonomy specific to one custom post type
- Custom Taxonomy back-end customizations
- Show a Category X’s custom post type on Category X archive page?
- Taxonomy custom post type URL
- Display all taxonomy terms, add class if term applies to current post
- Return the latest post from a custom Taxonomy and Post Type
- How to Filter custom post type by taxonomy?
- Displaying CPT and custom taxonomy side by side in Bootstrap 4 component
- Is it possible to have dedicated page for parent/child taxonomy?
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Get related posts of child term of custom post type
- Limit amount of posts made within a custom taxonomy
- Group CPT posts by custom taxonomy
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- list taxonomies from a custom post type
- Display a grid of taxonomy terms at root taxonomy page
- What’s the WP way to load remaining custom posts?
- limit value taxonomy based on previous taxonomy value wordpress
- How do I display the taxonomy for a custom post type in an array
- How to conditionally redirect to the post from a taxonomy page?
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- How do I display the grand child items of a taxonomy term?
- Taxonomies relations
- Is it better to use WordPress Custom Post Types or Taxonomies?
- Display Custom Taxonomy Alphabetically
- WordPress Doesn’t Generate Taxonomy Archive
- Suggested Post and Taxonomy structure
- Custom post with more than one custom taxonomy
- Get the taxonomy of a post hierarchically
- Adding custom taxonomy in same menu place with two custom post types
- How to make custom taxonomy into drop down select in a custom metabox
- How to get list of taxonomy slugs ordered parents>childs?
- How do I share categories across multiple post types?
- Multiple tag cloud filtering
- Get url.com/post_type/taxonomy/term work!
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Taxonomy in URL
- Listing all term items alphabetically / sorting loop
- Display related custom taxonomy posts in sidebar
- Only show posts with date of today or in the future (i.e don’t show past posts)?
- Different Category system needed for the Custom Post Type
- Three Most Recent Posts, One Per Term
- get_the_title() is returning results from previous loop
- How to Set Taxonomy Object Description?
- Custom select query for taxonomies that have posts categorized in another taxonomy
- Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink
- Querying two taxonomies with tax_query not woking
- Rename a slug label
- Main query not querying any posts in custom taxonomy template
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- Custom taxonomy (categories) on custom post type return no results
- Variable not working in WP_Query
- Hide meta box for everything BUT a certain custom post type
- get_category_link() for custom post type does not include custom slug rewrite?
- Control content before and after custom post type loop
- Targeting categories in custom fields
- How can I create an automatic drop down menu with my tags?
- How to define a term for custom taxonomy
- List custom taxonomy as navigation – taxonomy pages with all it’s posts?
- Alphabetically sort a taxonomy.php template by post title
- looping though custom post types and only return results in a given taxonomy
- Dynamically insert code to custom post type loop
- Custom Post Types not queried in Custom Taxonomy archives or Native archives
- Get taxonomy singular name instead of taxonomy slug inside $taxonomy query
- Show Taxonomies with admin area for custom post type?
- Custom taxonomy template list not working (404)
- Pull in taxonomy field of custom post type in new query
- Use the custom post type archive for taxonomies?
- Rewrite custom post type with taxonomy
- display posts of custom post type with custom taxonomy
- WordPress multisite – is it possible to have different taxonomies for each site?
- Custom Post Type not showing in main loop
- Query custom post types & Taxonomies and list them in a table on a page
- Taxonomy template page not working
- How to show list of taxonomy terms associated with specific post?
- Custom Post Type and Taxonomy Loop Output Is Wrong
- Changing CPT slug and taxonomy already registered in parent theme
- Creating custom post type posts and associating them with a post from another custom post type
- get_terms() parent, child and grandchild
- I have custom post type with custom taxonomy. But not found the taxonomy page..
- Group Custom post type in a taxonomy page by its child taxomony
- Copy/Move selected taxonomy terms to another taxonomy for posts
- Custom Taxonomy Terms in Menu lead to which page?
- Getting List of child terms from custom taxonomy parent
- List all Custom Post Type posts excluding certain Taxnomy term
- Get posts by category name
- Custom taxonomy query showing more than 4 posts
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- Looping through custom taxonomy and display custom post types (Custom Post Type UI)
- Using page title as a link to term archive
- Create a custom taxonomy template that loops through child categories in term order?