Use get_the_terms
to fetch terms for a specific post:
$terms = get_the_terms( $cpt_post['ID'], 'location' );
if ( $terms && ! is_wp_error( $terms ) ){
$output .= '<div class="cpt-meta">';
foreach ( $terms as $term ) {
$output .= $term->name . ' ';
}
$output .= '</div>';
}
Related Posts:
- Create a shortcode to display custom post types with a specific taxonomy
- Generate Shortcodes by Taxonomy
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Custom Post Type Loop within Shortcode
- Get custom post type list for every category shortcode
- How to display class name in this shortcode post query
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- Display CPT Category List as Shortcode
- Custom post type shortcode with taxonomy attribute not working and no errors
- Shortcode in excerpt
- Plugin Error on activating
- Shortcode display CPT Query only showing 1 post?
- How to Create Short Code Using Custom Post type
- trying to display custom post type with custom taxonomy value by shortcode can’t works [closed]
- Problem with shortcode
- Exclude a category from WP_Query
- Check if post type has term
- How do I Filter Custom Post Type by Custom Taxonomy in the newest WordPress RESTful API?
- Custom taxonomy not showing up when adding a new custom post type
- query multiple taxonomies
- wp_set_object_terms() is not replacing term, but creating a new one
- How to list all categories and tags in a page?
- WordPress custom taxonomy URL rewrite on spelling errors
- TV Show database – Best way for structuring it?
- Create an archive page for custom taxonomies
- Rewrite permalinks for custom posttype and custom taxonomy
- How to check if last uri segment is a custom post type or taxonomy term?
- Many to Many Taxonomies or rewrite rules?
- Query posts by custom post type and custom taxonomy
- Sort the main query in subcategories/terms?
- How to display the rest of categories on Portfolio filterable
- Highlight nav menu terms
- Custom Post Types, Custom Taxonomies and Permalinks ?
- get a list of posts from Custom Taxonomy
- Trying to manage templates on a blog with lots of custom taxonomies
- Display Custom Category (taxonomy) Name in Custom Post Type
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- removing custom tax & CPT slug, adding taxonomy term in front of custom type
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Custom post type and taxonomy permalinks – Structure
- Custom Post Types relationships
- Display Posts in Custom Post Types Timber
- How can i skip same post from taxonomy term?
- Set menu active state for custom posttype and category, given custom taxonomy term
- Multiple portfolios and single item in two of them (ideas?)
- Pagination for Custom Taxonomy Page [duplicate]
- Display custom post type category, while in a CPT category, then the posts beneath
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Hide post navigation if current post is in a category with only one post
- Customize Custom Post Type URL
- How to render a custom post type template with custom fields using shortcode
- I want to change the word “Tags” in WordPress to something else, but how?
- How to have this permalink structure: post_type/postname/custom_inner_page
- Set post terms for multiple posts
- Custom permalink with child taxonomy terms
- Display Registered Taxonomies
- Custom Taxonomy Not Showing in Front-End When Outputting a Custom Post Type with WP_Query()
- Pagination Not Working for Custom Taxonomy with Custom Query – 404 Error
- Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink
- Display custom posts randomly in custom taxonomy archive
- WP_Query parameter conflict
- Custom shortcode works in Elementor editor but not on frontend
- CPT Taxonomy As Archive Page – Error 404
- How to get all posts related to particular category name on button click?
- List all Custom Post Type posts excluding certain Taxnomy term
- Display custom posts for each category from its custom taxonomy
- Get custom category ID of current custom post within the loop
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- Conditional Statements
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Get newest created custom category (get_term_by and variables) (outside Loop)
- Custom Taxonomy Taxonomies of Same Name point to first created URL
- Displaying custom taxonomy menu in custom post type archive
- Taxonomy terms with the same name are updated between separate custom post types
- Custom taxonomy permalink without term, redirection to CPT slug
- Custom post type category link redirecting to 404 page
- Archive page URL for custom taxonomy and post type
- Display post count for a specific month
- Create custom post type categories
- Add other all taxonomies as meta boxes to custom post type
- How to get post type archive category title
- Remove CPT Slug with 2 taxonomies and 1 post meta
- URL with Hierarchical Taxonomies and same slug for all terms and sub-terms
- order taxonomy alphabetical
- Custom post type archive page not showing on archive-posttype.php
- Should I make a taxonomy to organize data like this?
- Display Custom taxonomy, Child terms and posts in a template Under Specific Parent terms
- Associate custom categories to different user IDs
- List all posts from custom post type by taxonomy
- Sort a custom post type loop by a custom taxomomy instead of chronologically
- changing post type in loop query
- Taxonomy and Rewrite Structure
- Pagination for a Custom Taxonomy
- Trying to create hierarchy between 3-4 custom post types
- Add custom taxonomies as class names to an archive page of custom post types
- Nested loop called with shortcode duplicating the content above the main loop
- Custom Post Type Base URL
- Only One Post of Custom Post Type Appearing on Template Page
- Sort ACF by custom taxonomy
- Taxonomy Archive URL + Template