fyr, an old discussion about importing from csv:
https://payloadcms.com/community-help/github/user-csv-import-for-a-collectionand also heads up, I wasn't able to replicate wordpress's media URL structure with payload. more context here:
https://github.com/payloadcms/payload/discussions/1153#discussioncomment-9278483i am in the middle of migrating a large wordpress project to payload. my migration script is pretty heavily tailored to my specific application, but here's a high level outline of my approach:
1. download a SQL dump of the wordpress database and store locally. this is my source of truth for the existing documents. this approach reduces latency, and cpu load on the existing (live) wordpress app, but requires you to "freeze" publishing on wordpress while the migration is in process.
2. migrate the "primary" content types, without relationships. for example in my application: books, authors, and publishers.
3. circle back and migrate the relationships: for example, assign author(s) and publisher to books.
4. (optional) delete any "orphaned" content, eg authors or publishers with 0 book relationships.
a couple notes...
- every payload collection has a
wordpress_id
readonly, indexed field with this format:
${post_type}:${ID}
. this makes step 3 easy: query a book's authors by their
wordpress_id
s, retrieve their payload IDs, use those to build the cross-collection relationships.
- For uploads, I have temporarily disabled
filesRequiredOnCreate
. This way I can create a document for every upload in my db without uploading the file. File upload would be the final step (5), only after I've built relationships between posts and media uploads in payload, and weeded out any orphaned entries (we have 100s of gbs of uploads, most of which are garbage). once the migration's finished, I'll re-enable
filesRequiredOnCreate
.
- for step 2, I iterate over every row returned from wordpress and process them in a queue (better-queue). the queue helps me manage throughput, handle exceptions, etc.
Where you fetch the wordpress data you want to migrate in bulk, then adjust the format of the data as needed, then loop over it and create new documents in corresponding payload collections
Wordpress offers a REST API, so you should be able to create a script on a per-data-type basis
I would start with migrating users, and then focus on moving content
But I don't think this migration is impossible
This is probably not an easy task, though there may be some plugins made to assist in this kind of thing (I don't know of any offhand)
I'm seeking guidance on the process of transferring data from a WordPress website to Payload CMS. Specifically, I aim to export all the content, including posts, pages, media files, and any other relevant data from my WordPress site, and import it seamlessly into Payload CMS. Can anyone provide step-by-step instructions or recommend tools or methods to accomplish this task effectively?
Star
Discord
online
Get dedicated engineering support directly from the Payload team.