Home Forums Front-end Issues Custom Field Not Displaying in Front End Reply To: Custom Field Not Displaying in Front End

  • You need to specify the “$post_id” value when getting fields from a term.

    The post ID to use is "$taxonomy_$term_id" The taxonomy name I know, it is “product_cat” but you need to get the term id for the currently displayed category and them put them together.

    Something like this might work, but you may need to work on it

    $queried_object = get_queried_object();
    $post_id = $queried_object->taxonomy.'_'.$queried_object->term_id;

    the you can supply the correct post id when getting the acf field

    <div style="background-image: url('<?php 
        the_field(‘category_background_image', $post_id); ?>');">

    this is all covered under getting values from other places here