Home Forums Add-ons Flexible Content Field update_field and flexible field


update_field and flexible field

  • I was looking at the update_field() information page and I was wondering if this is supported with the flexible content field? I noticed that there are no field keys showing for sub-fields.

    I would like like to build my own script for inserting data into posts using this field. Can this be done?

    • James

    • April 11, 2016 at 1:24 am

    Hi @mageguild,

    Thanks for the post.

    Yes this can be achieved, you can also opt to pass the field names instead.

    For flexible content field and the Repeater field, I would suggest you make use of the update_sub_field() instead.

    Please have a look at the following page for more info on this:

  • @acf-support Could you post an example of using update_sub_field() to add data to a field inside a flexible content layout?

    I can’t see any example for other than a repeater field in the doc page and tried using the Flexible Content field name and field and value but no luck yet.

    update_sub_field( array( 'my_fc_layout_field_name', 1, 'document' ), 623 );

    In the screenshot is reflected my Flexible Content field and Layout with field (document) I want to add the media ID value 623.

    • B4rT

    • January 24, 2020 at 7:05 am

    I also stuck on this problem. I’ve imported some posts, but one group ist not accessible via get_field(), although all values appear in the backend. So I guess I need to update these group values to register them correctly in the database. But how to do it? They are placed inside flexible content fields themselves, so the meta_key in the database look like


    Which means, ‘content_section’ is the flexible content field with different sections inside, and these sections have got a group called ‘button’ with a child field ‘text’ (for the button text) inside.

    I also tried to access them with the field_keys, but no success yet. Any ideas? Thanks a lot!

Viewing 4 posts - 1 through 4 (of 4 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.