Support

Account

Home Forums General Issues Add data to ACF fields on post creation? Reply To: Add data to ACF fields on post creation?

  • You need to create the post first and then add the fields using the update_field() function https://www.advancedcustomfields.com/resources/update_field/ to update each field. You will need to use the field key for $selector when doing this. You’ll also need to make sure that you’re using the right type of value depending on what type of field you are updating, so you’ll need to investigate how ACF stores the needed values or if there are any special requirements for the $value of a specific type of field.

    It might be possible to update it all at once using wp_insert_post(), however, this will require understanding how every type of field is actually stored in the database as well as making sure that you also add the correct field key references for every field. Doing it this way would be much more complex than using update_field()