Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating excisting field keys #183

Open
wietsecats opened this issue Dec 12, 2023 · 1 comment
Open

Migrating excisting field keys #183

wietsecats opened this issue Dec 12, 2023 · 1 comment

Comments

@wietsecats
Copy link

We have a project with a whole bunch of ACF fields (in acf-json) which are linked to excisting content. We would like to migrate to acf-builder but the keys are generated automatically, so then we lose all the content. Doing a search-replace in the database is tricky.

We have managed for the fieldgroup to add the key to fieldbuilder so it generates the correct group key. but for fields it goes wrong because it adds the fieldgroup also to the field:

$builder = new FieldsBuilder('5def5ss7895b4s', ['position' => 'side', 'title' => 'Page options']);

current situation for a textfield: field_5def5ss7895b4s_634ec2238f005
desired situation: field_634ec2238f005

Is there a way to add manually a key 'key' => '634ec2238f005' when you add a group or field zo when can migrate. I cannot believe I'm the first to have this question :)

@gustavo-roganti
Copy link

@wietsecats can't you use the ->setCustomKey('') function for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants