You can use get_the_terms(). I’ve adapted the following from an example on that page:
$terms = get_the_terms( $post->ID, 'visits' );
if ( $terms && ! is_wp_error( $terms ) ) :
$visits_name = array();
foreach ( $terms as $term ) {
$visits_name[] = $term->name;
}
$terms_list = join( ", ", $visits_name );
echo $terms_list;
endif;
EDIT:
Using wp_list_pluck, as suggested by Telos, is much easier:
$terms = get_the_terms( $post->ID, 'visits' );
if ( $terms && ! is_wp_error( $terms ) ) :
echo join( ',', wp_list_pluck( $terms, 'name' ) );
endif;
Related Posts:
- How to add Text before my Custom Term and hide it when empty
- How to automatically apply woocommerce product title to all product images alt tags?
- remove tags from posts in php
- WP_Query | Help me create a search term with an ‘OR’ relation?
- How to get the term before the last from a custom taxonomy?
- display most popular tags in two columns
- How to create filterable portfolio in WordPress?
- WP_Query use for a filter with multiple Taxonomies and Terms
- Displaying Only Certain Tags in Loop
- query if on page/2/?
- Display Post co-authored in Author Page
- Add attribute / custom attribute to product in woocommerce
- Highlight Current Tag in wp_tag_cloud
- Show Custom Taxonomy Title
- conditional statement for custom taxonomy
- Add relevant tag to search results
- get_the_terms – only top level
- Get Custom URL For Custom Taxonomy
- Rename “Portfolio” slug?
- How to create a linked tag list in my sidebar
- Way to querry data (tags) from a wordpress database?
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- Grab posts by multiple categories
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- How to get post’s current parent term ID?
- Adding Taxonomy Image to taxonomy loop [closed]
- Display parent and child taxonomies in separate drop down select fields
- Edit the_category (); for a hierarchical display
- Filtering a function’ output for a new continued function
- stripping tags from excerpt in WordPress is not working
- How to filter custom taxonomy term name, slug, and description?
- Ajax filter button display all posts
- Hierarchical taxonomy list with modificated term links
- Exclude product attributes from taxonomy terms loop
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- Listing titles and custom fields of entries within subcategories
- How to tag the main tag? [closed]
- Create a a form for custom taxonomy terms
- Storing content into a custom taxonomy
- add custom tags for custom post type in wordpress
- How to add Post Tags to a new element in header.php?
- Check in which custom taxonomy belongs and change the style
- How to break up php code to avoid echo
- Taxonomy term description with style, only if the description exists?
- PHP displaying wrong custom taxonomy images
- Commas in Tag Cloud
- making my own “related pages” / “pages you might like” section
- Getting a WordPress tag to print inside of a traditional php echo
- Hi need update in my terms for other taxonomy
- How to change the author box selection on a post to a custom taxonomy
- WordPress: Export/Import Yoast meta title & description to custom taxonomy
- How to exclude labels from certain categories in a shortcode?
- WP_Query – How to query all of post types categories
- Display acf taxonomy attachment
- Tag title not being returned in page title of tag archives
- Get taxonomy terms that share a common object property
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- ACF Taxonomy field values not select in backend
- Multiple Tag Filtering
- Categories does not show Block editor WordPress
- clicking on the_tags() generated tags to show all tagged posts page
- custom taxonomies not working
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- How to put a before and after with tags in a wordpress entry?
- How to separate the taxonomies list from the form so that editing taxonmies is the same as pages and posts?
- Add Custom Taxonomy into Script
- View tag description on page
- Using Tag Groups: Displaying groups and adjacent tags of current post
- Show content by using tags
- How do you change the tag font size in the repeater-template.php [closed]
- PHP tag in post content makes wordpress go crazy
- Add Alt attribute to image served with php
- Display product attributes for current product
- How to only fetch certain Tag ID’s
- enumerating custom taxonomies?
- how to display child terms with parent terms in custom taxonomy?
- Page 2+ of taxonomy archives does not recognise sort-order from dropdown
- WordPress Custom Post Type and sort by Tags
- How to show all of aspecific post type that has taxonomy and a specific term
- Insert wordpress tags below posts via functions.php
- Pass custom value to custom taxonomy
- WordPress – show all posts + ones with specific tag
- Query specific posts per user selections from dropdown menus
- Php echo into tag
- Change background image based on tags
- how to loop through blog posts in php
- How do I change the Go To Categories link in the term_updated_messages
- Display terms on product page with shotrcode
- The search doesn’t work properly
- Query posts by custom taxonomy slug in WP REST API?
- WordPress different custom tag being displayed in on tag list
- Get category name of current post (CPT UI)
- Three different queries on same page
- I want to show image from custom field image on my custom page template
- How to make multiple custom taxonomies sit under custom post type slug?
- Count post with tags within one category?
- Same Custom Post Type Slug and Custom Taxonomy Slug, with hierarchial unique permalink structure
- WordPress CPT & Custom Taxonomy with the SAME Permalink Structure
- Remove slug and custom post type name from URL
- Hot to show custom post type taxonomies on archive page