Hi there,
I currently have an ACF field group with flexible content, and in that flexible content field I have 3 layouts.
On one of the pages, the flexible content has been generated like so:
flexible_content
- layout_1
- layout_2
- layout_1
- layout_3
There has been a requirement to wrap these in another flexible content field, so now a page could be created like so:
wrapper_flexible_content
- flexible_content_layout_1
- - layout_1
- - layout_2
- - layout_1
- - layout_3
- flexible_content_layout_2
- - layout_4
- - layout_5
- - layout_5
- flexible_content_layout_1
- - layout_1
- - layout_2
My question is: Is there a way I can copy the content from my first example into my *nested* second example?
So far I have tried:
– Putting the nested field group on the same page as the non-nested field group, then using jQuery to move (.append()) the fields from the old layout to the new layout. This didn’t work and I ended up with no content, as I suspect the field names were incorrect.
– Renaming the fields name attribute, although I got stuck here as I couldn’t work out what the correct name should be / search and replace was almost impossible as I was trying to rename:
acf[field_5e2050834104e][row-0][field_5e2736cdc3c76_field_5df8db9fdf653][row-0][field_5e172af8c42cd_field_5e172e564da75]
to:
acf[field_5e284aa29a775][field_5e284aa29a775_field_5df8db9fdf653][row-0][field_5e172af8c42cd_field_5e172e564da75]
Can anyone help me with a function or can I do a database query to nest this content?
I have 115 pages of 5-10 different flexible content layouts each, so I’d rather not copy and paste… I will if I have to!