Support

Account

Home Forums General Issues Correct Way to Create a New ACF Post Reply To: Correct Way to Create a New ACF Post

  • The problem with using update_field() is that according to the WordPress Codex, calls to update post meta after wp_insert_post() may fail if the post is still in memory (cached).

    I did try that and it worked most of the time, but occasionally the post meta was not updated.

    An “acf_insert_post()” function would be fantastic. Or a function that fixes the meta_input() array by adding the appropriate ACF info.

    It looks like I might be able to construct something using the “get_sub_field_object()” function and passing the field name.