Support

Account

Home Forums Bug Reports Problems manually updating a repeater field via code on a newly inserted post Reply To: Problems manually updating a repeater field via code on a newly inserted post

  • The field name will work on posts on in situations where a value for a field already exists in the database, and it will usually work with fields that are simple text content like text, textarea, single select fields, radio and some others.

    The problem comes in with special types of fields like repeaters, flex fields, checkboxes, relationship, and many others fields that store values in complicated ways other than simple text values or include multiple database entries. For these ACF needs the field key to know how to store the value. It gets the field key by looking in the database for the meta key "_{$field_name}". Since this entry does not exist for posts that do not already have a value, ACF does not know what to do with the value so assumes it is a simple text value.

    In the case of a repeater the value is probably serialized by WP. Then when ACF tries to retrieve the value later if doesn’t know what to do with the value because it’s not in the correct format so it just ignores it, possibly triggering a PHP error in the process.