Home Forums Add-ons Flexible Content Field add_row in a clone field


add_row in a clone field

  • Hello, I’m having an issue trying to insert a row into a flexible content which is a cloned field in another flexible content layout.

    In my database the field have the value field_60dd6f2f4890b_field_6075935dba60e and when I try to use
    addrow(field_60dd6f2f4890b_field_6075935dba60e, ['acf_fc_layout' => component_name', ... ...], $field_id);
    nothing seems to happen. The error seems to come from the field value, and I don’t really know why because it’s the same as the database when doing some tests manually.

    I can’t really find any help on the docs about this feature.. Maybe I can get some advice here.


  • if you are finding a field with a value of “field_60dd6f2f4890b_field_6075935dba60e” then this is likely the field key reference and not the field value.

    I cannot really tell by your description what your field setup is. Add row will not work with nested repeaters including flex fields. Can you give a better description of your field setup?

  • Sure, here’s how the setup looks like


    The “content” is a flexible content field
    The “aside-content” is a cloned field from an ACF group just made for clones.

  • Hey @hube2, do you have any news about this subject?
    I’m back at it today and you didn’t answer the last comment, I’ll try to figure this out. Hope I’m not bothering you.


  • Found out the solution, after some digging, I’ve realized that I didn’t try using the add_sub_row function. Which solved my problem using the following code:

    add_sub_row(array(self::content_field, $this->row, self::aside_content_field), [
        'acf_fc_layout' => 'aside_image',
        'aside_img_credit' => 'test',
        'aside_img_image' => 196
    ], $this->post_id);

    Thanks for the help and sorry for the double posts!

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.