Home Forums Front-end Issues Get values from taxonomy term custom fields


Get values from taxonomy term custom fields

  • Hello!
    I have stumbled upon a guide that explains how to get values from a taxonomy term custom fields.
    My goal is for each tag to have its own color which is why I added a color picker custom field to tags. The goal is to use the color value from the color picker field as a header background because every project with a different tag will have a different colored background. I have used the code from the article mentioned above in my main template, but the color value is not retrieved.
    Colors will be retrieved in my main template which all posts will use, but depending on the tag they have and the color picked for that tag, the color has to change.

    I have used the following code:

    $term = get_queried_object();
    $color = get_field('field_638e303483e3d', $term);
    echo $color;
    <style type="text/css">
            background-color: <?php echo $color; ?>;

    How do I go about retrieving the color value?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.