ACF Taxonomy Field Value in Single Posts

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:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Instant access to 390+ Bricks code tutorials with BricksLabs Pro