You can use get_the_terms() to retrieve terms from a custom taxonomy which are attached to a post.
In your Loop you could do the following to retrieve the terms,
$departments = get_the_terms( get_the_ID(), 'department' );
This gives you an array of WP_Term
s. If for example, you want to use just the first one you could do it like this.
echo ($departments && is_array($departments) ? $departments[0]->name : '';
Related Posts:
- Custom post type page with parameter
- Change Dropdown jQuery to show/hide but with default place holder that shows all
- How to Add Custom Taxonomy To Woocommerce Plugin
- How to completely disable a taxonomy archive on the frontend?
- Get Custom Taxonomy ID within loop
- register_taxonomy with multiple object type and update_count_callback
- Categories under custom post types doesn’t show properly
- Ajax filter with custom taxonomies
- Row actions not showing? Why?
- Show ACF field from custom taxonomy and display on the single template
- Dynamic Custom Post Type Plugin
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Custom Taxonomy Not Showing in Menu
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Get rewrite slug of custom post type in template
- Weird problem happening with custom taxonmy when creating/updating posts
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- 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
- get_object_taxonomies() returns empty array for custom post type
- How to customize a permalink (URL) structure?
- Get custom post type list for every category shortcode
- 404 error when navigating to a taxonomy page with Cyrillic, what’s wrong?
- Use custom metabox to update automatically a post after a given date
- Plugin fatal error
- Different Category system needed for the Custom Post Type
- Problems wp_insert_post and save_posts filter
- Custom post type’s extra fields – how to handle?
- Trying to get custom post of a custom taxonomy
- Control content before and after custom post type loop
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- 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
- Nested Custom Taxonomies | Incorrect posts when querying
- Validate Custom Post Type fields
- 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
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- Using page title as a link to term archive
- Most viewed post of custom post type
- Setup page template array in a custom post type
- Writing a custom Glossary plugin
- How do I ensure that post_type and Taxonomy use the same slug?
- How to get post count of specific taxonomy that have store name & category
- Custom post type category link redirecting to 404 page
- Custom front-end form for adding post – Category problem
- How to show the post which checkbox is not selected
- Is it possible to get the specific content on the search page?
- 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
- How to show Custom Post Types under Taxonomy in a new WordPress page template?
- Error 404 change permalink term custom term taxonomy
- I have a random letter appearing before my content. Where to start looking for the cause?
- pagination problem listing custom post types of taxonomy in wordpress
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- 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
- How to Use A Custom Post Type as Taxonomy for Another Custom Post Type
- Insert custom taxonomy into category query
- % encoded URL giving 404 error in WordPress
- tax_query not working?
- Add active class to foundation 6 tabs while looping categories
- Which File Populating CPTs in Slug URL
- Not Able to List CPT Based on Taxonomy Term
- Show tags of custom post types in WordPress
- Facing some Issues on Two Parts Custom Post Type Taxonomy Names
- 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
- How to Fix WordPress 500 Internal server error due to custom post type
- Associate custom categories to different user IDs
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Render custom taxonomy query as single template
- Values inside a custom field to determine which category posts to display
- Exclude Custom Post Type from shared Custom Taxonomy
- WordPress Custom Post Type and sort by Tags
- Custom Taxonomy Showing in WP Menu
- Issue on Adding Taxonomy to Custom Post Type Using Function
- 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?
- Custom Loop for custom post type. Compare by meta_value?
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- How to dynamically register custom post type
- Custom Post Type urls not working
- Make term slugs of custom taxonomy available in WP REST API for custom post type?