I want to migrate my data from Alchemy and CMB2 to MetaBox.io.
Is there any boilerplate script or some plug-in to migrate fields and CPT data from these to the ones I am setting up using MB?
So far, I am thinking to use the REST API to get a flat object data and then build a parser to populate the fields accordingly. But I believe there must be some plug-in that allows to map existing data to the fields I'm creating in MB.
If your fields are just simple fields, you don't need to migrate at all. Meta Box, CMB2 and Alchemy use the same way to store value. So, all you need to do is creating same fields in Meta Box, make sure their IDs match the meta key in CMB2 / Alchemy.
That even works for repeater in CMB2. I haven't tried with all field types of CMB2, but so far it works for me pretty well. So please just try to create same fields in MB first. If something goes wrong, then you should write a small PHP script to:
Hi Anh, so I'm trying to replicate my data structure from Alchemy over to MetaBox.io and I think I managed to have the same serialised array. Now I have this problem: my custom code allowed to select another post type to relate content, and I used the slug to identify the post rather then the ID.
I did this because this way if the post was accidentally deleted it could be re-created and as long as the same slug was kept, the relation would still be in place.
I assume you use IDs in the 'post' custom field select rather then slugs. Correct?
So in the end, I'm afraid I'll have to write that migration script, unless you can come up with some brilliant solution that I don't see. 🙁
I'm quite confused about the slug. WordPress doesn't use it to store custom fields for posts. WordPress use a combination of (post ID, meta key, meta value) in the DB. That's the post ID that Meta Box is using.
Anyway, if there's anything involved with "slug", then it's not supported by Meta Box :(. So a custom migration script is required, I guess.