Fix duplicate posts when re-importing content without slugs - #8138
Draft
faisalahammad wants to merge 2 commits into
Draft
Fix duplicate posts when re-importing content without slugs#8138faisalahammad wants to merge 2 commits into
faisalahammad wants to merge 2 commits into
Conversation
Author
|
CI status update Psalm (8.2) fixed. The import-id refactor in Two checks remain, unfixable here:
|
faisalahammad
force-pushed
the
fix/8066-import-dedup-by-source-id
branch
from
August 16, 2026 16:26
bc6f6d6 to
fa684a4
Compare
Imported posts now store the source import id as private post meta. When a slug is empty, the import looks up that meta to find the existing post instead of creating a new one. This stops re-importing the same CSV from duplicating draft rows that have no slug.
faisalahammad
force-pushed
the
fix/8066-import-dedup-by-source-id
branch
from
August 16, 2026 16:33
fa684a4 to
192ac43
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #8066
Proposed Changes
Content import duplicates posts when a source CSV row has no slug. The import only matched existing posts by slug, so a row with an empty slug was always treated as new and inserted again on re-import. One reported run of 1,320 lesson rows produced 1,342 lesson posts.
The fix persists the source
idas a private post meta (_sensei_import_id) on every imported post. When the slug lookup misses, the import now falls back to that meta to find the existing post, so re-importing the same CSV updates the same posts instead of creating new ones. Rows with no slug and no id still cannot be matched and are documented as a known limit.Screenshots
No visual change.
Testing Instructions
id.New/Updated Hooks
None.
Deprecated Code
None.
Changelog entry
Changelog Entry Details
Significance
Type
Message
Fix duplicate posts when re-importing content with empty slug columns by persisting the source import id on each imported post.