Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Migration from WordPress to Sanity using custom parsers and Sanity's CLI.

3 replies
Last updated: Apr 28, 2021
Hello! Does anyone here have experience with WordPress to Sanity migration?
I’m trying to migrate wordpress content to the Sanity Studio, but I can’t seem to find a way of doing it that doesn’t involve lots of hours writing a complicated script. I’ve had a look at
this GitHub-repo by User, but I can’t seem to make it fit my data. All help would be highly appreciated!

PS: I’ve also checked migration but I can’t find any info on WP to Sanity
Apr 22, 2021, 2:50 PM
very interested in this as well … following
Apr 22, 2021, 3:08 PM
user D
I think hours of a complicated script is required for most any migration with complex data.
Does your WordPress application have any custom post types? What plugins are you using? Do you have direct access to the database and schema? Is your data readily available via the REST api? These are the kind of questions that I think can have an impact on what route you go with in your migration.

User's solution looks pretty straightforward with using XML exports from WordPress, which is a good solution for basic out of the box WordPress. More complex datasets, on either side, makes this task a custom one no matter what, I think.

I've worked on several migrations from WordPress to something else, though not to Sanity. Send me a message if you want to chat more?
Apr 22, 2021, 10:19 PM
Thank you,
user Q
, and sorry for the late response! I made it work by carefully adding/removing custom parsers to User’s example-migration project. It was especially helpful to look at the source-code from the block-tools repository. This made some of the more complicated parsers (especially internal referencing) more intuitive.
After successfully parsing the data I had great success using sanity’s CLI to import/export/modify datasets/documents. The Sanity GraphQL playground was also very helpful in the process.
Apr 28, 2021, 9:21 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?