• Resolved milesgilmour

    (@milesgilmour)


    We have a plugin that uses ACF fields included via PHP using the code generated via the “Tools\Generate PHP” option. Up until 6.1.1 the code the was working fine and including a layout field.

    Since 6.1.1. the Layout Field header is there, but nothing else renders.

    Including the Layout Field code via functions.php seems to work OK.

    No errors are thrown, no warnings and nothing in the logs. Something has changed between 6.0.7 where this was working and 6.1.1. where it isn’t.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter milesgilmour

    (@milesgilmour)

    Yes, same here – rolling back to 6.0.7. fixed it.

    I thought the problem might be something to do with my configuration or selection of fields, but I’ve been doing some debugging and the simplest single field defined via PHP doesn’t work in a super simple plugin wrapper, but exactly the same code will work if pasted into the functions.php on the same site.

    Plugin Contributor Iain Poulson

    (@polevaultweb)

    Hi @milesgilmour this should be fixed in 6.1.2 released earlier today. Please let us know how you get on.

    Plugin Contributor Liam Gladdy

    (@lgladdy)

    This issue was caused by acf_add_local_field_group being called too early, before ACF had been initialised. Whilst it’s fixed in ACF 6.1.2, we would still advise you update your code.

    You should wrap any calls to acf_add_local_field_group inside an action hooked to acf/include_fields, such as:

    add_action( 'acf/include_fields', function() {
        //acf_add_local_field_group code
    } );
    • This reply was modified 1 year, 3 months ago by Liam Gladdy.
    Thread Starter milesgilmour

    (@milesgilmour)

    @polevaultweb I can confirm that 6.1.3 (I missed 6.1.2) fixes the problem. Thanks for the quick response – that means the updated version of ACF can be rolled out quickly by us without any other updates required.

    @lgladdy Thanks, will use the action going forward.

    Plugin Contributor Iain Poulson

    (@polevaultweb)

    Thanks for letting us know, @milesgilmour – great to hear 🙌

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problems with layout fields included programmatically’ is closed to new replies.