Support

Account

Home Forums Front-end Issues Taxonomy dont returning values for fields

Helping

Taxonomy dont returning values for fields

  • I’m assigned a custom fieldtype to some taxonomy terms.
    When the taxnomy is checked on post panel the fields are visible and I can fill the input fields.
    They saved the data normally.

    On front end when I do

    
    $campos = get_the_terms($post->ID, 'grupos-de-campos');
    $campo = array_pop($campos);
    var_dump($campo);
    

    I can see the Taxonomy selected

    
    //the return on front end
    object(stdClass)#2489 (10) {
      ["term_id"]=>
      string(2) "10"
      ["name"]=>
      string(10) "Estande 03"
      ["slug"]=>
      string(10) "estande-03"
      ["term_group"]=>
      string(1) "0"
      ["term_taxonomy_id"]=>
      string(2) "10"
      ["taxonomy"]=>
      string(16) "grupos-de-campos"
      ["description"]=>
      string(0) ""
      ["parent"]=>
      string(1) "0"
      ["count"]=>
      string(1) "1"
      ["object_id"]=>
      string(2) "95"
    }
    

    But when I try retrieve data from that fields ACF return false.
    Look..

    
    $custom_field = get_field( 'anuncio_pavilhao', 'grupos-de-campos_' . $campo->term_id );
    var_dump($custom_field);
    
    //the return on front end
    bool(false)
    

    Any solution for this?

  • Hi @felipeandrada

    Thanks for the code snippets. Your code looks perfect so it must be 1 of 2 things:

    1. You have a spelling mistake in your field_name ‘anuncio_pavilhao’
    2. that you are using get_field in your functions.php file which at the moment ACF is not able to run correctly in.

    Are either of these possible?

    Thanks
    E

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Taxonomy dont returning values for fields’ is closed to new replies.