Home Forums ACF PRO update_sub_field() does not work in nested fields


update_sub_field() does not work in nested fields

  • I need to update the value of a sub field which is nested 4 levels deep in repeater fields. Doing a get_sub_field() returns the correct field initially (which is set to “No”) but updating does not work:

    echo get_sub_field('field_55f004b554d89');
    echo get_sub_field('field_55f004b554d89');

    Both output’s show “No” and even after a page refresh, the value is still “No”.

    As it’s nested a few levels down, I’m not sure if I can use the array selector instead?

  • To use update_sub_field I think you need to be inside loop for the field or you need to specify the path to the nested field. See the last 2 examples on this page

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

The topic ‘update_sub_field() does not work in nested fields’ is closed to new replies.