while ( $loop->have_posts() ) : $loop->the_post();
//Edit Width post type
$categories = get_the_terms(get_the_ID(), 'services');
$separator=", ";
if ( ! empty( $categories ) ) {
foreach( $categories as $category ) {
echo '<a class="cat_item" href="' . esc_url( get_category_link( $category->term_id ) ) . '" alt="' . esc_attr( sprintf( __( '%s', 'your-themes' ), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator;
}
}
endwhile;
You can try in loop
More in: https://developer.wordpress.org/reference/functions/get_the_terms/
Related Posts:
- query multiple taxonomies
- Sort the main query in subcategories/terms?
- Filtering WP_Query Dynamically on the Front-End
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- display post count in archive page that have relation with another taxonomy term
- Display all Custom taxonomy terms and their relevant custom posts
- Get posts of an specific term of a custom taxonomy
- How to pass taxonomy terms to WP_Query along with $args?
- Get The Post Type A Taxonomy Is Attached To
- How to limit the number of terms (terms acts like categories)
- Counting Posts of a Given Post Type Having a Specific Taxonomy?
- Not Able to Insert Taxonomy Term Using wp_insert_post()
- array_pop() expects array, boolean given for $event_type_term ->slug
- Displaying Posts Related to Other Posts by a Taxonomy Term?
- Displaying custom post type by first letter through custom taxonomy
- Separate Custom Post Type Taxonomy by Comma
- Querying Posts by Taxonomy From Alternate Network Site
- Trouble adding custom featured image for custom taxonomy TERMS
- Get child terms of current term of the current post
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- Creating a function that receives the taxonomy terms that have been changed in a custom post type
- Query for posts in 2 taxonomies
- Get the terms of a custom taxonomy for a specific author in author template
- Ordering Custom Post Types with WP_Query
- Paginated Taxonomy Term Archive including one post per term
- How to get posts from multiple custom post types according to it’s custom taxonomy terms?
- Is it possible to create a shortcode that will query a post based on taxonomies?
- 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
- Displaying a custom post types custom taxonomy value?
- Display CPT posts based on specific taxonomy
- Show listings from Impress Listing plugin in random order using taxonomy and terms
- Update post terms with custom taxonomy
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Get template part using a custom taxonomy term
- Archive for custom taxonomy lists all posts instead of current taxonomy
- How to restrict users and admin from creating new taxonomy terms?
- Displaying custom taxonomy in the admin list of a custom post type
- Which post does a taxonomy term belongs to?
- How do I display the taxonomy term alongside the post type post title?
- Custom post taxonomies as tax_query terms?
- Custom WP Query on custom meta and sort by multiple meta keys value
- Custom taxonomies relationship
- How do I display the taxonomy for a custom post type in an array
- Custom Post, set object Taxonomy terms in plugin
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Add Custom Post Type of specific Custom Taxonomy to regularly blog loop
- Display taxonomy terms, child terms and posts in a template
- Use custom walker to add taxonomy terms to main nav menu
- WP_Query orderby and tax_query
- Add term to custom post type on draft
- How to get WordPress term attached to the Post?
- Get parent category id from child category page for custom taxonomy
- WordPress wp_query() basic question about args
- How to get only child terms from a custom taxonomy of current post type?
- How to Display Posts From Category Within a Custom Taxonomy?
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- how to get this tax_query working?
- The Difference Between Categories and Tags and Taxonomies and Terms
- How to get the post terms from a child taxonomy
- display posts of custom post type with custom taxonomy
- Custom post type and custom taxonomy 404 on page 2
- Get the link of the first post of a custom taxonomy in a custom taxonomy list
- Commas not displaying in implode
- How can I get 3 different taxonomy type terms in a div class element?
- Get terms for a specfic post from multiple taxonomies in custom post type
- WP_Query order custom post type with certain meta key value by post modified date
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Using get_terms() to list terms from one custom taxonomy AND from one specific built-in category
- set object terms after some some time of published post – functions.php
- Sort custom posts by date and then by taxonomy
- How to search through all child taxonomies using WP_Query?
- Change the term based on the value of a $variable using wp_update_post in submitting a form
- Get all posts for custom taxonomy term
- posts_per_page is not working by term
- WP_query sort by taxonomy
- Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies
- Custom Post Type / Taxonomy / Term – what template to use to avoid 404-page?
- Display title of all custom posts from same taxonomy term on a custom post template
- wordpress does not see the correct custom taxonomy hierarchy
- Get category list & taxonomy list from different post type using post id?
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- WordPress add taxonomies/terms list as a menu in archive page
- Hide Custom Taxonomy title if not associated with another Custom Taxomony
- WP_Query for CPT with filter by another WP_Query
- Custom Taxonomy Query by Taxonomny not working
- Fetch posts list from fist CPT taxonomy term and list under 2. CPT
- How to query posts by meta keys AND under specific category?
- Shortcode display CPT Query only showing 1 post?
- Storing/querying custom date data
- WP Query Post Type with same Taxonomy name
- List custom taxonomy terms
- Display associated taxonomy child name on single CPT page
- Issue On Listing Woocommerce Parent Tag List
- Sort ACF by custom taxonomy
- Query custom post type and group by taxonomy
- Dynamically count the number of custom post types associated to a custom taxonomy
- Taxonomy Archive URL + Template