How to access parent taxonomy term custom fields?

Created on 8 July 2024, 5 months ago
Updated 10 July 2024, 5 months ago

Problem/Motivation

Trying to access custom fields from parent term(s) on a node.

Steps to reproduce

Having the Token module installed and enabled, Create a node with a taxonomy term, which the taxonomy term has a custom has a custom field. This custom field seems to only be available for the current term in the dropdown Available Token list. You can access the parent(s) and root term, but only the term name or ID, All parent custom fields are not available.

I tried the below combinations even though they were not listed in the Available Tokens, and did not work.
[node:parent:field_taxonomy_name:entity:field_category_help]
[node:field_taxonomy_name:parent:entity:field_category_help]
[node:field_taxonomy_name:entity:parent:field_category_help]
[node:field_taxonomy_name:entity:field_category_help:parent]

Proposed resolution

I need to know if I am missing where to access these, or if it is not supported in this version? And If it is not supported, would it be much work to create a patch for it? I'm not a programmer. Maybe this is a Token module issue and not a Metatag request? I don't know where to start.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Active

Version

2.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States tyler-durden

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tyler-durden
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Try looking at the Token help info at the Taxonomy structure, those tokens will show what is available from within the [node:field_taxonomy_name:entity] structure, you should be able to stack the tokens from that point, so it's probably something like [node:field_taxonomy_name:entity:parent:name] to get the name of the parent term on the term referenced on the field_taxonomy_name field on the node.

  • πŸ‡ΊπŸ‡ΈUnited States tyler-durden

    Thanks DamienMcKenna. That does work to pull the taxonomy parent name, but I want to pull a custom field from the parent taxonomy which is not working. I will poke around the Token help info at the Taxonomy structure with a set of fresh eyes in the next day or so when I have more time.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Does it work if you do [node:field_taxonomy_name:entity:parent:entity:field_something]?

  • πŸ‡ΊπŸ‡ΈUnited States tyler-durden

    I just a moment to test that and it didn't work either.

Production build 0.71.5 2024