Here’s the correct syntax for what you’re trying to do, if there’s just the single value for the ‘series’ custom taxonomy slug that you’re trying to retrieve. You were passing the whole array to your echoed string. I made a new variable $series which pulls the first/only value in the $terms_slugs array. And simplified a few other things you didn’t need in there. 🙂
<?php
$terms = get_the_terms( $post->ID, 'series' );
if ($terms) {
$terms_slugs = array();
foreach ( $terms as $term ) {
$terms_slugs[] = $term->slug;
}
$series = $terms_slugs[0];
echo "/assets/products/{$series}/logos/{$series}-logo.png";
} else {
echo "nothing to see here";
}
?>
Related Posts:
- Exclude specific slug in ‘get_terms’
- How to edit/remove a term that’s in multiple taxonomies?
- How to create drop down for child categories of current taxonomy being viewed?
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- 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
- 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
- How to add a shortcode function that returns the taxonomy slug of the actual post within the loop
- generate random slug when adding taxonomy
- Display taxonomy term slugs
- Change order of Custom Taxonomy List
- custom taxonomy and pages rewrite slug conflict gives 404
- 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?
- Get current term’s ID
- term_link() filter or rewrite and howto?
- 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]
- 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
- How to get a list of taxonomy terms which are being used only within certain post types?
- WPML Translating a term/taxonomy programmatically
- Allow only 1 instance of each term in each custom taxonomy
- Outputting an array of term meta values in a custom WooCommerce tab?
- Get terms from posts submitted within a certain time
- get_terms: determine if taxonomy term has children
- Display post taxonomies tree
- 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
- 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
- get_terms not returning any custom taxonomies
- Search Query for Multiple Terms In Same Taxonomy
- What does ‘category__in’ mean in queries?
- Get all terms, including unchecked, or get the terms outside loop
- get_term_link not working
- How to write sql query to get the posts from a custom taxonomy term name
- Get only immediate children (and not grandchildren) of a hierarchical custom taxonomy term
- How to support fifteen thousand terms in WordPress?
- How to group all terms children’s in custom taxonomy?
- Display Posts by Custom Taxonomy Chosen Terms
- Show template part if part of term
- How to display a custom taxonomy without a link?
- Build filter for post-type + multi taxonomies + multi terms
- How do I get term data associated with the current post, where the result is not wrapped in HTML?
- Hide terms if they aren’t the same as the current term
- Corrupted nav-menu?
- The best way to display taxonomies
- Dynamically set taxonomy term and show admin notice on post save
- WP 4.8 : new taxonomy syntax for get_term_by and get_term_link ?
- List Top 5 taxonomy terms based on number of post
- How to show post list based on taxonomy term?
- Can you hide empty terms using get_term_children?
- get_term_by works but get_terms doesn’t?
- 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 add custom taxonomy terms to posts in bulk
- How to list Custom Taxonomy
- List terms of custom taxonomy if matches other taxonomy
- How to output taxonomy term (incl. link to archive) on author.php?
- Display Child Categories of Current Post ID
- Include get_term_link inside search
- 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?
- How to use custom slug and custom templates for custom taxonomy?
- How to list custom taxonomy terms alphabetically by last word
- 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
- setting a custom post type taxonomy term by code
- How do I check to see if a specific child term has shared posts with another set of child terms within the same taxonomy?
- Output slugs to use as class names for every taxonomy a post is attached to
- set_object_terms for custom taxonomy in custom post type – not working
- Orderby taxonomy term id using get_posts not working
- Permalink Rewrite to include Custom Taxonomy Term
- Order posts with custom taxonomy array
- Exclude 2 in 3 terms of A Taxonomy from all Archives
- 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
- Hide empty categories on widget