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
- Get custom post type by category in a page template
- register_taxonomy with multiple object type and update_count_callback
- Categories under custom post types doesn’t show properly
- Ajax filter with custom taxonomies
- Filter posts with ajax form and checkboxes
- How to get only one category of custom post type?
- Custom Taxonomy and tax_query Issue?
- Get all taxonomies for all post types
- Row actions not showing? Why?
- Append taxonomy terms as class names in markup?
- Show ACF field from custom taxonomy and display on the single template
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- Plugin fatal error
- Different Category system needed for the Custom Post Type
- Problems wp_insert_post and save_posts filter
- Get term name without a foreach loop
- Custom post type’s extra fields – how to handle?
- Trying to get custom post of a custom taxonomy
- Main query not querying any posts in custom taxonomy template
- How to add and clear custom post types and taxonomies in a plugin? Considerations for existing data
- 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
- Create a Dropdown Selector and Redirect for a Custom Taxonomy in WordPress?
- 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?
- set object terms after some some time of published post – functions.php
- 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?
- Why are custom taxonomies only appearing on the edit page of one of these types, but not the other?
- Error 404 change permalink term custom term taxonomy
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- Plugin Development using classes – Public & Private Callbacks
- Assigning categories to custom post types via a front-end form; only works for native post type
- Changing CPT permalink
- 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
- Taxonomies are not showing in the category dropdown
- Combine multiple separate lists into one
- 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
- Having issue on Loading Meta Data From CSV to CPT
- How to Use A Custom Post Type as Taxonomy for Another Custom Post Type
- Insert custom taxonomy into category query
- Custom Taxonomy – fields
- % 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
- The most recent post of custom taxonomy
- 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
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- 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
- Show Custom Post Type taxonomy term that matches custom field
- WordPress Custom Post Type and sort by Tags
- Custom Taxonomy Showing in WP Menu
- Get term_id for each instance of custom taxonomy
- How to internationalize the sub menu name “categories” in Custom post type?
- Order by custom field attribute
- 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?
- Inserting two categories