You can post the terms by using wp_get_object_terms
$terms = wp_get_object_terms($post->ID, 'departments');
if(!empty($terms)){
foreach($terms as $term){
$exampleName = $term->name;
$exampleSlugs[] = $term->slug;
}
}
Alternatively you can try to first ensure that the right taxonomy is being used:
$taxonomies = get_taxonomies();
echo '<pre>';
print_r($taxonomies);
echo '</pre>';
If everything is allright you’ll see an array with all the taxonomies, and the taxonomy “departments” is present in this array.
When you want to output all the terms you can then use this:
echo '<pre>';
$departments = get_terms( 'departments', 'orderby=count&hide_empty=0' );
print_r($departments);
echo '</pre>';
Then you can use it anyway you want.
Related Posts:
- Exclude a term of a taxonomy with a custom post type in a search
- How to display product subcategories into my custom post type single page
- Get post from custom post type order by two taxonomies
- WooCommerce – Custom related product (Spareparts)
- Custom Taxonomy not working front side Woocommerce
- Custom Taxonomy is disabled on Edit page
- Complex strcuture as CPT or taxonomy for use in woocommerce product variations [closed]
- How to manage a bookstore
- Issue On Listing Woocommerce Parent Tag List
- Custom post types, taxonomies, and permalinks
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- How to get all taxonomies of a post type?
- Permalinks: custom post type -> custom taxonomy -> post
- How do I query a custom post type with a custom taxonomy?
- How to Add Tags to Custom Post Type?
- Add category base to url in custom post type/taxonomy
- Include custom taxonomy term in search
- Custom Taxonomy specific to a Custom Post type
- List all posts in custom post type by taxonomy
- Mixing custom post type and taxonomy rewrite structures?
- Advanced search form with filters for custom taxonomies and custom fields
- Can multiple custom post types share a custom taxonomy?
- How to Add Custom Fields to a Custom Post Type?
- Remove taxonomy slug from a custom hierarchical taxonomy permalink
- Display all posts in a custom post type, grouped by a custom taxonomy
- Custom post type single-{custom}.php not working
- Remove Custom Taxonomy Metabox from Custom Post Type Screen
- Get terms by taxonomy AND post_type
- Theme localization of “slugs” (custom post types, taxonomies)
- Rewriting a custom-post-type permalink with taxonomy term?
- Saving Taxonomy Terms
- Get Posts by Custom Post Type ,Taxonomy, and Term
- Get The Post Type A Taxonomy Is Attached To
- Custom Taxonomy as checkbox or dropdown
- Getting custom taxonomy from custom post type
- Taxonomy: Why ‘with_front’ => false DOES NOT WORK?
- Shouldn’t this be easy?! Custom post type/custom taxonomy permalink
- Custom Post Type Permalink / Rewrite not working immediately
- How to Add Custom Taxonomy To Woocommerce Plugin
- How do I append multiple taxonomies to the URL?
- List all the tags from a custom post type
- Efficient Taxonomy Intersection
- How to get the posts of a custom taxonomy term
- WordPress Rewrite Rules for Custom Post Type and Taxonomy
- Show Custom Taxonomy Inside Custom Menu
- Display current taxonomy term when inside custom post type
- How to create a custom template for a custom taxonomy?
- Are custom post types lost when the theme is changed?
- Custom post types filtered by taxonomy using REST API v2
- limit selection of custom taxonomies to one?
- Filtering a custom post type by custom taxonomy in archive template
- Permalink Structure for Multiple Post Type Archives by Taxonomy
- get term archive url / link
- Get term slug of current post
- What are the differences between custom post type and custom page templates?
- Custom Post type & Taxonomy URL structure
- Create a shortcode to display custom post types with a specific taxonomy
- Remove slug in taxonomy url
- List the categories under custom taxonomy
- Taxonomy, Terms, and Template Files
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- Custom Post Type and Taxonomy URL rewrite
- Any way to make posts inherit properties/taxonomies through a single assigned taxonomy
- Exclude a category from WP_Query
- Check if post type has term
- Custom Taxonomy as Dropdown in admin
- Combining Multiple Taxonomies in one URL
- get_the_category_list or get_the_tag_list for custom post types and taxonomies?
- Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?
- Why does my custom taxonomy show a total count across all post types
- Set relationship between custom_post_types
- How to Make a Separate RSS Feed for Each Custom Post Type
- How can I rewrite URLs to pass taxonomy and post type values to the query?
- Custom Taxonomy’s Label to change the text appearing in Appearance > Menu
- Assign posts to taxonomy terms instead of the taxonomy terms to posts?
- How to completely disable a taxonomy archive on the frontend?
- $wp_query->queried_object->ID throws warning: Undefined property
- Automatically create child pages when saving a (parent) page
- Check if a custom taxonomy archive page is being displayed
- How to limit the number of terms (terms acts like categories)
- Permalink rewrite 404 conflict- WordPress Taxonomies/ CPT
- Get Custom Taxonomy ID within loop
- Custom Post Types not showing on Custom Taxonomy archive page
- WP insert post and custom taxonomy
- custom post type or taxonomy
- Pagination throws 404 error on custom taxonomy archive pages
- Create page to handle form submission
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Select All in Parent Category, Group by Child Category?
- What should I use – Taxonomies, custom fields, Post Type?
- How do I Filter Custom Post Type by Custom Taxonomy in the newest WordPress RESTful API?
- Registering custom taxonomy with unique name, a good practise?
- custom post type and custom taxonomy permalink
- How to build a complex page structure
- wp_dropdown_categories in custom post type with custom taxonomy
- get_query_var() not working in pre_get_posts
- Ordering posts by custom taxonomy in admin area
- Custom Post type in separate database table for syncing
- Remove admin menu for custom taxonomy attached to custom post type
- Custom taxonomy not showing up when adding a new custom post type