Support

Account

Home Forums Front-end Issues Not able to retrieve field values

Helping

Not able to retrieve field values

  • Hi Everyone!

    So I am having trouble retrieving values to display on the front end from my custom fields. I am trying to display these fields on a page so I am not calling any of these functions in a loop unless its a flexible content field.

    The field setup is as follows:

    1. Select (2 options)
    2. Group (containing regular fields and flexible content fields)
    3. Group (containering flexible content fields)

    The value of the select determines which of the groups show up.

    The problem is that I cannot use the regular ACF functions to access the values. It does not seem like those functions are working.

    When I do a var_dump though I get all of the data as expected. So it’s just been very frustrating.

    For example:

    1. DOESN’T WORK

    get_field(‘the_content_I_want’)

    2. DOES WORK

    $get_the_parent = (get_field(‘the_parent_group’));
    $child = $get_the_parent[‘the_content_I_want’];

    echo $content[$child];

    Its like at some point get_field just stops working.. it works for the first select field, but I can’t utilize it for the other fields. Its very confusing. I have tried using the sub field functions as well because in the var dump sub fields are being referenced. These functions don’t work either.

    I also have some flexible content fields which I am trying to grab values from (using a loop) but have_rows keeps coming back false. Which is not correct.

    Its weird cuz everything is in the var dump… I just can’t access it with the ACF functions.

    Geez I hope I am explaining this ok LOL Its so hard to write it out…

    Let me know if theres any info I can provide to help solve this. I spoke to another PHP developer I work with and he said he thinks that there may be a bug/shortcoming with this API and he suggested I post here to see.

    I’ve used ACF many many times in the past… This is the first time I’ve been really stumped by something!

    Thanks in advance!

  • @alliepiegirl

    I’ve run into issues where if i’ve named the Flexible Content Field Recipes and then have a sub block called Recipes it throws things off.

    If the data is there, it may just be easier to loop through it with a foreach.

    Phil

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

You must be logged in to reply to this topic.