Support

Account

Home Forums Bug Reports Bug: acf_get_reference() is returning incorrect field reference Reply To: Bug: acf_get_reference() is returning incorrect field reference

  • If you are using wp_insert_post() then

    1) There cannot be a post ID before it is inserted, you will only have the correct post ID after it is inserted.

    2) The fields will not exist on the newly inserted post. Even with the correct post ID the fields will not exist and ACF will fail to find the reference and fail to update the field. When adding/updating fields that do not exist you must use the field keys, see the update_field() documentation.

    Field keys, unlike field names, must be unique to your entire WP site. All field keys must be unique, they cannot be repeated in multiple field groups. If you have duplicate field keys then this is more then likely the source of your issue.