acf-extended / ACF-Extended

🚀 All-in-one enhancement suite that improves WordPress & Advanced Custom Fields
https://www.acf-extended.com
238 stars 27 forks source link

Toggle layout removes layout from ACF front-end form #130

Open Dennisscholten opened 1 month ago

Dennisscholten commented 1 month ago

After toggling a flexible layout and saving the page, the layout itself disappears from acf_forms that are displayed on the front-end. In the back-end the layout is there and works as expected.

Disabling the 'load_value' function in field-flexible-content-actions.php makes the field appear in the front-end form (but also in the content, of course). My guess is that the filter for unsetting layouts works through on front-end displayed acf_forms. Is there a fix for this?

acf-extended commented 4 days ago

Hello,

Thanks for the feedback!

Yes, this is the side effect of how ACF load values on the front-end. ACF use same method when using get_field() or when rendering actual fields input (<input type="text" ... />) within an acf_form().

Unfortunately, at the moment, there is no way to make the difference between them. Additionally, ACF cache the value the first time it is retrieved, which will present the same output if you display the Flexible Content with have_rows() on the same page as the acf_form() itself.

I'll have to implement some workaround here in order to make it behave correctly. I'm adding it on my todo list see what can be done.

Thanks!

Regards.