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
- Display all posts in a custom post type, grouped by a custom taxonomy
- Custom Taxonomy’s Label to change the text appearing in Appearance > Menu
- How to completely disable a taxonomy archive on the frontend?
- How to limit the number of terms (terms acts like categories)
- How can I list all the categories under a Custom Post Type (taxonomy)?
- How to show term-specific post list, without posts associated with child terms?
- Query multiple taxonomy in Custom Post Type
- Conditional two level dropdown filter for custom post type
- Show all custom post type posts sorted by custom taxonomy then by another custom taxonomy
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- 404 error PageNavi custom type taxonomy | wordpress
- Remove “-2” from a Toolset Types URL with the same post name
- Query for posts in 2 taxonomies
- Custom post type taxonomy template
- Is slug “type” reserved and can’t be used in taxonomy rewrite?
- Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?
- Taxonomy Templates
- Custom Post Type and Taxonomy combination
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- Custom Taxonomy Creates Unwanted Integer Terms on Post Save
- wp_query to find posts by year and month
- Custom Post Type Loop within Shortcode
- How to check the terms in single custom post type template
- get_template_part for each level of taxonomy term
- Query Multiple Taxominies Across Multiple Post type’s
- Display CPT posts based on specific taxonomy
- WordPress Genesis custom taxonomy archive shows 3 repeats of each post
- Loop custom taxonomy to get lists of cutom post types?
- Custom Post Type Taxonomy Filters
- 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
- Get related posts of child term of custom post type
- How do I display the taxonomy for a custom post type in an array
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- Suggested Post and Taxonomy structure
- Custom post with more than one custom taxonomy
- Get the taxonomy of a post hierarchically
- How to get list of taxonomy slugs ordered parents>childs?
- Multiple tag cloud filtering
- Get url.com/post_type/taxonomy/term work!
- Different Category system needed for the Custom Post Type
- Three Most Recent Posts, One Per Term
- 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?
- Get taxonomy singular name instead of taxonomy slug inside $taxonomy query
- display posts of custom post type with custom taxonomy
- WordPress multisite – is it possible to have different taxonomies for each site?
- Query custom post types & Taxonomies and list them in a table on a page
- How to show list of taxonomy terms associated with specific post?
- Custom Post Type and Taxonomy Loop Output Is Wrong
- Creating custom post type posts and associating them with a post from another custom post type
- 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
- Getting List of child terms from custom taxonomy parent
- Custom taxonomy query showing more than 4 posts
- Cant’ Display Custom Post Type Title Base on Tax Terms
- How do i display post from a taxonomy term?
- What is the most efficient way to execute recursive complex queries?
- How to get post count of specific taxonomy that have store name & category
- Duplicate slug/permalink issue while adding same post name
- How to display list of custom post taxonomy terms and their posts (if any)?
- Filter taxonomy by CPT
- How to show related posts of category on post within custom posttype
- Excluded Custom Taxonomy Term Posts Displaying in loop
- Some posts not displaying by taxonomy term
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Get all posts for custom taxonomy term
- posts_per_page is not working by term
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- % encoded URL giving 404 error in WordPress
- CPT: multiple loops with different terms
- tax_query not working?
- Add active class to foundation 6 tabs while looping categories
- Showing taxonomies with terms that are attached to custom post
- I want to create an archive and single page for a custom taxonomy for a custom post type
- Taxonomy’s title
- Display all posts from single taxonomy term
- Connect 8 Taxonomies to One (Main) taxonomy. How to?
- Filter By Term Not Working – Custom Post Type
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Custom post type taxonomy template and URL confusion
- Looping through custom taxonomy in one template
- WordPress query posts by custom post type not workng
- Loop with Custom Post Type and Taxonomies
- Custom post type post taxonomies
- WordPress Custom Post Type and sort by Tags
- Listing custom post type items from a couple of custom taxonomies
- Catergory args causing loop not to show
- List custom taxonomy terms
- How do i get the taxonomy term name on the CPT archive page?
- Display associated taxonomy child name on single CPT page
- Issue On Listing Woocommerce Parent Tag List