get_the_terms()
will always return an array; but because you have only one ‘project_category’, you can simply use its first element:
add_shortcode( 'return_taxonomy_slug', 'my_shortcode_return_taxonomy_slug' );
function my_shortcode_return_taxonomy_slug() {
$terms = get_the_terms( get_the_ID(), 'project_category');
return $terms[0]->slug;
}
Related Posts:
- Exclude specific slug in ‘get_terms’
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Group posts that matches a term in a loop
- How to edit/remove a term that’s in multiple taxonomies?
- How to handle “the_terms” inside loop
- How to create drop down for child categories of current taxonomy being viewed?
- how to create a proper query for getting a list of users with taxonomy related meta key
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- Operations with custom fields values in a loop
- Get custom category image from menu
- Display Taxonomy Terms in an option tag with value being the slug
- Changing taxonomy term by slug (wp_update_term)
- Sort order by slug for looped child terms of custom taxonomy
- Display all posts that use a custom taxonomy
- How can I reduce amount of ifs and else ifs in this specific block of code?
- Returning One custom taxonomy term name
- Echo custom taxonomy slug
- Set term on an attachment using wp_set_object_terms and want to display the full term text but it’s showing a slug instead
- List terms of custom taxonomy if matches other taxonomy
- How to get the term description in a taxonomy term archive query?
- generate random slug when adding taxonomy
- Output slugs to use as class names for every taxonomy a post is attached to
- Query pages by child term
- Display taxonomy term slugs
- Change order of Custom Taxonomy List
- Remove taxonomy base or term from url
- How to get current term in my custom taxonomy in WordPress?
- Custom order of terms for custom taxonomy in admin and website
- Front End Post Save Child terms
- Taxonomy slug by term ID
- Dropdown: Display terms from B only if has relationship with a term A selected
- wp_get_object_terms – How can I order the resulting array by hierarchy?
- Custom Taxonomy terms with latest post ordered by date pagination issue
- How to set hierarchical terms to a post using wp_set_object_terms
- Echo taxonomy term meta on author.php
- Hierarchical display of custom taxonomy
- Advanced custom fields – taxonomy terms images [closed]
- How to call custom taxonomy categories with shortcodes
- List only first-level children of specific custom taxonomy term
- get_terms of post->id
- get / list categories and counts filtered by custom taxonomy term
- Modify main loop in taxonomy archive page
- How to get a list of taxonomy terms which are being used only within certain post types?
- WPML Translating a term/taxonomy programmatically
- Outputting an array of term meta values in a custom WooCommerce tab?
- get_terms: determine if taxonomy term has children
- get_term_children returns WP_Error for custom taxonomy
- Exclude Taxonomy Terms from Template Via Back End?
- Displaying terms by first letter
- Print terms with taxonomy and metabox value
- Same taxonomy for different object types
- Displaying terms based on loop posts?
- How to show all possible parents and children of a hierarchical taxonomy term?
- Failure to add term meta
- Hierarchical Taxonomy Terms Select Menu Output with selected=”selected” Set
- Search Query for Multiple Terms In Same Taxonomy
- What does ‘category__in’ mean in queries?
- Using WP_Query and Query_post for the loop?
- Check If Taxonomy A and Taxonomy B has same Slug, 301 Auto Redirect Tax A to Tax B if True in WordPress
- How to get_the_term_list() from multiple taxonomies?
- Display Posts by Custom Taxonomy Chosen Terms
- How do I get term data associated with the current post, where the result is not wrapped in HTML?
- wp_dropdown_categories – how to save in widget?
- Loop to display ONLY custom taxonomy parent information [closed]
- echo a specific custom taxonomy term on a different custom taxonomy archive
- Loop through custom taxanomy in post and display custom fields from posts
- How to show post list based on taxonomy term?
- Display empty custom taxonomies differently than with one with posts
- Double slash in the_terms URL
- How to call a custom taxonomy term name inside a function?
- How to get this value inside RETURN
- How to list Custom Taxonomy
- Custom Taxonomy List with Children
- Page for custom taxonomy
- Display Child Categories of Current Post ID
- Problem with sorting in custom child taxonomy archive page
- Set two terms for a post when they differ only by an accent
- How can I show links for custom posts group by taxonomy current term and sub-term?
- display ACF repater field in archive page
- How to add pagination in Terms
- Infinite Scroll appending Next Product Category Term pages
- Listing Cities A custom taxonmy by selection order
- Add A CSS Class To A Menu Item When A Custom Taxonomy Term is Present On Single Post
- Count tags for current post and save into custom meta field (and update it on post edit)
- Add term to taxonomy programatically
- How to show terms used only for particular custom post type. Filter creation perpose
- How do I check to see if a specific child term has shared posts with another set of child terms within the same taxonomy?
- set_object_terms for custom taxonomy in custom post type – not working
- Group & Sort Taxonomy terms by letter – Is there a better way?
- Orderby taxonomy term id using get_posts not working
- List active taxonomy terms
- How to get name of custom taxonomy
- Permalink Rewrite to include Custom Taxonomy Term
- Order posts with custom taxonomy array
- Altering term_id and name via $wpdb class
- How can I get parent term from a child term
- get_terms() – unexpected ‘=>’ (T_DOUBLE_ARROW) error
- Guest author – URL, base and custom taxonomy – working but unstable
- Loop posts without any taxonomy
- post_type_link not working for posts without terms