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
- Show all terms of a custom taxonomy?
- How to Add Custom Fields to Custom Taxonomies in WordPress CLEANLY
- Edit tag cloud widget number
- How to automatically apply woocommerce product title to all product images alt tags?
- Creating custom Woocommerce attribute taxonomies from a plugin
- remove tags from posts in php
- How to paginate a list of custom taxonomy terms?
- WP_Query | Help me create a search term with an ‘OR’ relation?
- tag search using WP_Query
- Get used terms by an author as array of strings
- How to get the term before the last from a custom taxonomy?
- show limited tags in an article
- 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
- How to add a post or page tag to the list of classes appearing in the body tag’s class attribute?
- Displaying Only Certain Tags in Loop
- query if on page/2/?
- Display Post co-authored in Author Page
- Include a specific post to the query_posts and remove it if it is already in the returned list
- Add attribute / custom attribute to product in woocommerce
- Tag title not being returned in page title of tag archives
- Get taxonomy terms that share a common object property
- How to update posts’ custom taxonomy selection?
- How to retrieve taxonomy Metabox fields in frontend
- 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
- ACF – Can’t get custom post type by taxonomy
- 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?
- WordPress search query, how to modify the sql
- How do I create a WP endpoint that retrieves all custom post types that have a tag?
- Using Sprit-sheet on WordPress categories
- Add Custom Taxonomy into Script
- How to insert text into post based on category – via single.php file
- Get Posts by Custom Taxonomy on Custom Post
- View tag description on page
- Display tag links on archive page?
- Using Tag Groups: Displaying groups and adjacent tags of current post
- str_replace not preserving whitespace
- Show content by using tags
- How to associate dynamic PHP page for chosen WordPress tag?
- How to replace hard-coded list of custom taxonomy terms based on custom field query [closed]
- Get a list of tags present in a paged front page
- 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
- Notify admin (by email) if post added with specific tag
- 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?
- Custom Taxonomy Link Text Echo Name Not Slug
- Custom Taxonomy as Link
- WordPress Rewrite Issue
- Limit Taxonomy Parents
- A Space being added to url generated by custom plugin
- Page 2+ of taxonomy archives does not recognise sort-order from dropdown
- Get category id for a custom category and display it in a class
- WordPress Custom Post Type and sort by Tags
- Saving category as insert post
- How to show all of aspecific post type that has taxonomy and a specific term
- Insert wordpress tags below posts via functions.php
- Using tag to output text in Genesis?
- Pass custom value to custom taxonomy
- Is there a way to randomize and connect a background and header image?
- 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
- Exclude specific product tags from related products in WooCommerce 3+ [closed]
- 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?
- How can I change the URL via add_rewrite_rule()
- 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 do I organize posts based on their taxonomy?
- 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
- translating a custom taxonomy term in a shortcode
- Remove slug and custom post type name from URL
- how can I get the selected term of a custom taxonomy
- Getting checkboxes for some tags in a search box
- Hot to show custom post type taxonomies on archive page
- How to change product title color in shop page if product has specific product tag (Woocommerce)?
- Show the terms of the hierarchical taxonomy
- How to Bulk Update CPT Taxonomy Values Using CSV Lookup Table