Home › Forums › General Issues › Category Color › Reply To: Category Color
Elementor is looking for a field on the post, this field does not exist on the post, it exists on the taxonomy term. Elementor cannot do what you are looking for.
It this instance elementor does use the ACF function get_field(), this is not the case with all field types. Because of this you can use an acf/format_value filter with a priority of > 10 so that it runs after the built in ACF filter, to alter the value.
In this filter you would get the terms that the post is assigned to using get_post_terms(). For the post ID your would use get_the_ID(). This will return an array of terms. The you need to loop over this array, event if there is only one, and then get and return the color from the term
$return get_field('category_color', $term);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.