What about using:
echo get_the_term_list( $post->ID, 'artist-genre', '<li>', ',</li><li>', '</li>' );
instead, to generate the HTML list?
Or simply:
the_terms( $post->ID, 'artist-genre', '<li>', ',</li><li>', '</li>' );
that’s a wrapper for get_the_term_list()
.
Also notice that you’re missing the is_wp_error()
check, in your code snippet, because wp_get_post_terms()
can return the WP_Error
object, for an unknown taxonomy. But the the_terms
function takes care of that and returns false
in that case.
Related Posts:
- Custom post type single-{custom}.php not working
- Get Custom Taxonomy ID within loop
- Get custom post type by category in a page template
- Categories under custom post types doesn’t show properly
- How to get a list of term names of the custom post type im currently on in single.php
- is_singular won’t call my functions?
- Ajax filter with custom taxonomies
- Filter posts with ajax form and checkboxes
- Disable single pages and archives and keep preview
- How to get only one category of custom post type?
- Append taxonomy terms as class names in markup?
- Show ACF field from custom taxonomy and display on the single template
- WP_Query search posts by custom post type and custom taxonomy
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- How to output wordpress custom tags separated by comma?
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- How to check the terms in single custom post type template
- Weird problem happening with custom taxonmy when creating/updating posts
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- How to display selected taxonomies by their parent
- Custom Field Order by Last Name and First Name
- Single Template that can be applied only via URL
- get_posts of Custom Post Type AND Custom Taxonomy
- How do I display tags for a custom post type single page?
- Received nothing after executing AJAX post function
- Get custom post type list for every category shortcode
- 404 error when navigating to a taxonomy page with Cyrillic, what’s wrong?
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Categorize custom post type
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Different Category system needed for the Custom Post Type
- Not Able To Render Single-CustomPostType.php File
- single-{post_type}.php not working
- Cant get paginations on single.php to work with my custom post types
- Including all post id’s of a custom post type into an array
- Control content before and after custom post type loop
- Get custom post type categories to show up in menus
- Show current custom taxonomy
- Different options per post type in WP_Query
- Creating a non-hierarchical Taxonomy that behaves like categories
- When I choose category from dropdown then everything working fine.But in backend it checked only child not parent [closed]
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- Query custom post types & Taxonomies and list them in a table on a page
- Custom post type and custom taxonomy 404 on page 2
- Nested Custom Taxonomies | Incorrect posts when querying
- Commas not displaying in implode
- add custom tags for custom post type in wordpress
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Foreach loop returning more than one item when querying taxonomy
- Function to erase every post from a taxonomy
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- Using page title as a link to term archive
- Setup page template array in a custom post type
- How do I ensure that post_type and Taxonomy use the same slug?
- Custom post type page with parameter
- How to get post count of specific taxonomy that have store name & category
- Create a Dropdown Selector and Redirect for a Custom Taxonomy in WordPress?
- Change Dropdown jQuery to show/hide but with default place holder that shows all
- Custom front-end form for adding post – Category problem
- set object terms after some some time of published post – functions.php
- update custom taxonomy custom fields
- Filter taxonomy by CPT
- Get all post under custom post type grouped by custom filed value in custom taxonomy
- Check that a slug is present in the get_terms request
- Assigning categories to custom post types via a front-end form; only works for native post type
- How can I write slugs / permalinks as: custom post type -> custom taxonomy and custom post type -> custom taxonomy (one CPT and many taxo)?
- pagination problem listing custom post types of taxonomy in wordpress
- Taxonomies are not showing in the category dropdown
- get_the_terms child terms for current post/custom post only
- Combine multiple separate lists into one
- Filter Custom Post Type Posts by Taxonomy
- Change Search display for Custom Post Type
- Show parent category and subcategory once in while loop
- Custom search for a custom post type in WordPress
- Custom Taxonomy – fields
- tax_query not working?
- Add active class to foundation 6 tabs while looping categories
- Making permalink for custom post type/custom taxonomy. Stuck with 404 in the single post
- The most recent post of custom taxonomy
- Show tags of custom post types in WordPress
- WordPress query posts by custom post type not workng
- Show custom taxonomy not in submenu
- Getting a 404 on single custom post type page when using rewrite on a custom taxonomy
- Pods pagination erases my sub menu
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- Display Taxonomy Term for CPT on single-CPT.php
- How to Fix WordPress 500 Internal server error due to custom post type
- How to display category wise posts on seprarate template
- Values inside a custom field to determine which category posts to display
- Exclude Custom Post Type from shared Custom Taxonomy
- Show Custom Post Type taxonomy term that matches custom field
- WordPress Custom Post Type and sort by Tags
- Looping taxonomy in taxonomy?
- Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax
- posting twice from an array?
- is_singular won’t call my functions?
- Custom Loop for custom post type. Compare by meta_value?
- Inserting two categories
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- How do loop categories post from according in WordPress? is it impossible to solve this problem?