Home › Forums › Bug Reports › wp_insert_post && update_field › Reply To: wp_insert_post && update_field
This is because there is no field key reference stored in the database for the field. Most basic fields that store only a text string will work, but most of the advance type fields, anything not listed under “Basic” when creating the field will probably not work with only a few exceptions.
In order to use update field for new posts where ACF fields do not yet exist you must use the field key when calling update field instead of the field name. This is explained in the update_field() documentation https://www.advancedcustomfields.com/resources/update_field/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
π Weβre excited to announce we've released Composer support for installing ACF PRO.
— Advanced Custom Fields (@wp_acf) January 31, 2023
π #ComposerPHP fans rejoice!
β¨ Please see the release post for all the details and full instructions. https://t.co/ebEfp61nlR
© 2023 Advanced Custom Fields.
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.