Support

Account

Forum Replies Created

  • I managed to figure this out, I needed to use update_sub_field instead of update_field.

  • 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 />”;
    }

    endwhile;

    $field[‘value’] = $value; //assign the values to the field value array
    }
    else
    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’);

  • Hi,

    Do you have an example of this I could reference?

Viewing 3 posts - 1 through 3 (of 3 total)