Skip to content

Fix issue where missing key might break import - #113

Merged
duncanmcclean merged 2 commits into
statamic:mainfrom
pierrepavlov:main
Oct 2, 2025
Merged

Fix issue where missing key might break import#113
duncanmcclean merged 2 commits into
statamic:mainfrom
pierrepavlov:main

Conversation

@pierrepavlov

Copy link
Copy Markdown
Contributor

Hi!

While trying to import contents from a WordPress site I ran into this issue where if you tried to use the Slug as the unique field it would break since the "slug" key was missing on "drafts" and other non-published posts.

@duncanmcclean

Copy link
Copy Markdown
Member

The "Unique Field" is intended to be a field which is present on every item, and marks that item as unique. It ensure entries aren't re-created every time you run the importer.

If only some of your items have slugs, couldn't you use something like an ID or title instead? 🤔

@pierrepavlov

Copy link
Copy Markdown
Contributor Author

Okay, that wasn't how the recommended export package exported the data though, the Slug could be missing from the items. I tried using the ID but it created another error, I'll try to get some time to re-create this issue and post it also.
Using title as the unique field is a no-go since it doesn't have to be unique.

With the small fix provided you would at least get the data imported instead of it throwing an error and forcing you to manually update the CSV-file. I'm fine either way though :)

@duncanmcclean
duncanmcclean merged commit 32260df into statamic:main Oct 2, 2025
17 checks passed
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

Successfully merging this pull request may close these issues.

2 participants