Skip to content

[6.x] Fix deleted terms reappearing after clearing the Stache - #15426

Open
duncanmcclean wants to merge 1 commit into
6.xfrom
sync-term-originals
Open

[6.x] Fix deleted terms reappearing after clearing the Stache#15426
duncanmcclean wants to merge 1 commit into
6.xfrom
sync-term-originals

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where deleting a taxonomy term would leave its slug behind in any entries referencing it, so the term would reappear as a "ghost" the next time the Stache was rebuilt.

This was happening because the UpdateTermReferences listener relies on getOriginal('slug') to know which slug to strip from entries, but TaxonomyTermsStore::getItem never called syncOriginal() on the terms it returned. Every other store gets this from BasicStore::getItem, but the terms store overrides that method (to support terms which only exist in entry data) and #5502 removed the sync it previously had in makeItemFromFile. As a result, any term fetched from the Stache, which is every term deleted via the Control Panel, had a null original slug and the listener bailed before touching any entries. Terms which only exist in entry data were never synced at all, so deleting them has never worked.

This PR fixes it by syncing the original state in TaxonomyTermsStore::getItem, mirroring BasicStore. Renaming a term outside the Control Panel (which #11058 patched separately) now also cleans up the old term and its references.

Fixes #11264
Caused by #5502
Related: #11058

`TaxonomyTermsStore::getItem` overrides `BasicStore::getItem` without syncing the term's original state, so `UpdateTermReferences` saw a null original slug on deletion and left the term's references in entries.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XzL1xhLTSn6kRxAi7UTcm8
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.

Ghost Taxonomies / Deleted Taxonomy not always deleting associations from entry

1 participant