I want to insert a row layout from an ACF Flexible Content field in one page (templates page) into the Flexible Content that is assigned to another page (Frontpage). The Flexible Content field group is the same. Can someone point me the right direction? Thanks. I am using the following code:
<?php
$template = get_field('flexible_sections',3012);
$frontpage = get_field('flexible_sections',796);
$inserted = $template[1];
array_splice($frontpage,0,0,$inserted );
$field_key = "field_64ca5341d1168";
update_field( $field_key, $frontpage, 796 );
echo "<pre>";
print_r($frontpage);
echo "<pre>";
?>
Although the array insertion occurs it seems its format is not correct and the template section is not recognized on the Frontpage. This is the array print:
Array
(
[0] => layout_section1
[1] => Library: Section 2
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] => Array
(
[acf_fc_layout] => layout_section1
[heading] => Frontpage: Section 1
[image] =>
[layout_name] =>
[position] =>
[subheading] =>
[shortcode] =>
[columns] =>
)
)