Consider this scenario:
CPT: Movie
Movie CPT Taxonomy: Movie Genre
Movie Genre Taxonomy’s field: Genre Color
Each movie will have only genre set.
The requirement is to get and use the genre color field’s value either on single movie posts or in the movie query loop for each movie post.
This Pro tutorial shows how to set up a custom function that takes the taxonomy name and taxonomy’s field name as arguments and returns the field value that can be used in the post loop when using ACF in Bricks.




The function is generic and can be used with any taxonomy and custom field of any type attached to that taxonomy.
Add the following in child theme‘s functions.php (w/o the opening PHP tag) or a code snippets plugin:
<?php
// Get the value of the specified field of the specified taxonomy.
function bl_get_acf_tax_field_in_post( string $tax, string $field ): string {
$term_id = get_the_terms( get_the_ID(), $tax )[0]->term_id;
return get_field( $field, "{$tax}_{$term_id}" );
}
Sample usage in Bricks editor:
{echo:bl_get_acf_tax_field_in_post(genre,genre_color)}
where genre is the taxonomy key and genre_color is that taxonomy’s custom field name.
