Sounds weird, but can you check if this code works:
$terms = get_the_terms( $post->ID, 'service' );
if ( $terms ) {
foreach ( $terms as $term ) {
$colour_scheme = get_field( 'colour_scheme', $term );
$svg_image = get_field( 'svg_image', $term );
// we check if the term is top-level term, in which case it does not have a parent
$parent = ( $term->parent == 0 ) ? $term : get_term( $term->parent, 'service' );
$parent_slug = $parent->slug;
$parent_desc = $parent->description;
}
}
I called the get_term()
directly, no need to fetch the term twice using get_term_by()
as well.
Related Posts:
- The Difference Between Hierarchical and Non-Hierarchical Taxonomies?
- Attaching taxonomy data to post with wp_insert_post
- How to get taxonomy term of the current page and populate queries in the template
- tax_query in get_posts() not working?
- wp_set_object_terms() — prevent overwrite?
- Is there a way to set singular/plural labels for taxonomy term names?
- Get_term_by only returns one item from array
- Add additional data to a specific taxonomy term when used in a post
- How to have “the most used tags” taxonomy always expanded?
- Get parent and first child taxonomy terms?
- Display the number of published posts for each custom taxonomy term?
- Display Post by taxonomy and taxonomy child if exist
- Missing term_id and term_taxonomy_id when adding a term using wp_insert_term() function
- What hooks/filters are there to alter selected terms on post save?
- Filter blog archive by category in URL
- tax_query: What to pass when I want to have all terms?
- Custom Roll/Custom Post Type – Can’t Select Categories
- Trying to list terms of a custom taxonomy using get_categories
- Add a term to an attachment submitted from front end
- Get and loop posts with all taxonomy terms
- Unable to delete a Category and Tag that share same slug
- what tables uses wp_get_post_terms
- I need template for my custom taxonomy term
- Show list of custom taxonomies when another taxonomy is selected
- WordPress as thesaurus/dictionnary: what approach?
- List a current posts’ taxonomy terms in a widget in WordPress
- Custom taxonomy is crashing Gutenberg
- How to show the category filter that’s shown on the ‘All post’ pages on a custom post type page in the admin area?
- Should I be using custom post types for this or terms and taxonomies?
- How can i list the categories of a post type, the taxonomy
- Custom WP Query: force entry for some taxonomy and have others optional
- Set post terms on post publish
- How to display terms from a custom taxonomy in a hierarchy AND with custom html markup?
- How can I find the taxonomy in edited_{taxonomy}?
- Using get_posts() with tax_query parameter set isn’t working with attachments
- extend HierarchicalTermSelector function with custom renderTerms
- Searching in wordpress using wp_term_taxonomy table
- Pulling Data from CSV vs. pulling data from database
- Count Published & Draft Posts Associated With Each Term
- “AND” relation in custom taxonomies
- Problem with Query on Taxonomy
- get_the_term_list – Return links to edit.php instead of link to taxonomy archive template
- How to sync to custom taxonomies (tag structure)
- the_terms characters not limiting
- Hierarchical list of custom taxonomy terms
- is_taxonomy() is not working
- Categorize wordpress tags
- How can i count post from my post type taxonomy
- How to return newly added terms when using wp_set_object_terms
- Blogroll links sorted by category in a table
- How to update a taxonomy term for a custom post type with auto incrementing number
- How to relate a user object to taxonomy term?
- Filtering elements by taxonomy slug
- Echo taxonomy name – second level
- Taxonomy vs Post Status
- Declaring arguments for taxonomy
- Taxonomy Checkbox Admin Panel
- Prevent certain subscribers from seeing specific taxonomies (changes frequently)
- child_of not working in wp_dropdown_categories
- How to display posts from two taxonomies?
- Using taxonomies to handle layout?
- Return single taxonomy term outside the loop
- How to relate to 2 taxonomy with category
- WP Search using taxonomy terms
- How to embed the Taxonomy Admin screen in to a Tab of a Settings Page in a plugin
- Calling an Archive Page with specific Tag/Tax ID
- Assign Multiple Values from Post Fields to Taxonomy Terms
- how can send a parameter by click on gender-link to filter a post by gender and product taxo
- How do I converge taxonomy category permalinks into one?
- Taxonomy terms are not checked when edit custom post
- Url leading to archive page, no matter what
- How to show taxonomy on front page
- Taxonomy.php inheriting first post
- How best to add Author or Artist to product
- Order custom taxonomy hierarchy
- Including taxonomy in searches
- Different Sidebar for same Taxonomy
- I want to get term by term_name without taxonomy
- How Do I Register Two Taxonomies with one Parent of the Other?
- taxonomy terms, inverted
- Same page for startpage and archive?
- How to share terms between two taxonomies?
- Taxonomy Rewrite Problem
- Taxonomy terms can’t find posts from archive.php or taxonomy.php
- What to do with shared terms splitting in WordPress 4.2?
- GET Taxonomy ID
- Hiding an Advanced Custom Field based on Taxonomy Field selection
- Non-Recursive get_term_children()
- How do I add tags/taxonomy to images + a query field on page to query ‘albums’ (images with same tag/taxonomy)
- Delete Term via edit-tags.php
- Child Terms not Displaying on the Taxonomy Term Admin Screen
- multiple taxonomies in wp_list_categories’ $args
- Description of a sub-taxonomy
- Order taxonomy terms by the frequency of use in the last 30 days
- I need to add new menu item inside the custom post admin menu
- How to orderby Taxonomy Term in a WP Query
- Add URL field to wordpress taxonomy
- Using autocomplete with post_tag taxonomy on attachments
- Display taxonomy terms when adding a link in the admin
- Bulk import in custom taxonomy