Home Forums Add-ons Flexible Content Field Load flexible content field from setting page Reply To: Load flexible content field from setting page

  • I got this working, here is the code encase anybody has the same problem:

    function copy_Dev_settings( $field ) {

    if ( is_edit_page(‘new’) ) { // only populate for new posts
    //echo “this is a new post!! <br />”;

    if( have_rows(‘deliverables’, ‘option’ )){ // if there are values on the settings page for this option
    $value = array();

    while ( have_rows(‘deliverables’, ‘option’) ) : the_row(); //starting at a specific row
    if( get_row_layout() == “new_deliverable” ){ //set the layout for the flexible content field

    $acf_fc_layout = ‘new_deliverable’; //set the values for layout and each sub field
    $deliv = get_sub_field(‘deliverables’);
    $days = get_sub_field(‘days’);

    if ( $acf_fc_layout == ‘new_deliverable’ ) { // apply the values to the correct layout and fields using the key value for that sub field
    $value[] = array(
    ‘acf_fc_layout’ => $acf_fc_layout,
    ‘field_5d0c21f3e31e1’ => $deliv,
    ‘field_5d0c220ce31e2’ => $days
    else {
    echo “cannot find development deliverables row layout”;
    //echo “<br />”;


    $field[‘value’] = $value; //assign the values to the field value array
    echo “nothing”;


    return $field; //return the full field array to the page/post etc

    add_filter(‘acf/load_field/key=field_5d0b74c37ad29’, ‘copy_Dev_settings’);