Support

Account

Home Forums ACF PRO Can I reuse the same fieldkey when defining fields in php?

Helping

Can I reuse the same fieldkey when defining fields in php?

  • I still have a few websites running fine with pretty recent versions of ACF and I wonder why they didn’t fail as my new projects despite my stupid habit of trying to keep the field names the same, thinking the information will be in a single place in the DB and will somehow be easier to access it no matter what field group I’m on.

    I just remembered those websites have the fields defined in PHP from the exported code from ACF… and I made sure the keys matched for the fields I reused through the site (e.g. “subtitle” is meant to appear in different post types, but defined in two field groups: One for posts and the other for pages)

    Would using the same key today -with the new version of acf pro- for different field definitions hurt in any way the system? I don’t care if the last one replaces the first one, as long as they all show up in all the groups I defined them.

  • It would not cause a problem if

    • The fields are in different groups, repeater rows, flex rows (not siblings)
    • The fields are identical in every way

    But as soon as you have two identical fields that are siblings or you have one key representing a completely different type of field than another, then you would run into issues.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Can I reuse the same fieldkey when defining fields in php?’ is closed to new replies.