[SITE-5390] Explicitly purge REST API term endpoints when draft posts are updated#357
Merged
AnaisPantheor merged 9 commits intodevelopfrom Dec 15, 2025
Merged
[SITE-5390] Explicitly purge REST API term endpoints when draft posts are updated#357AnaisPantheor merged 9 commits intodevelopfrom
AnaisPantheor merged 9 commits intodevelopfrom
Conversation
Contributor
|
Composer Changes
|
…terms SHOULD have their cache invalidated
e427f09 to
4e8dfaf
Compare
pwtyler
reviewed
Dec 15, 2025
pwtyler
approved these changes
Dec 15, 2025
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.
WordPress Core introduced two optimizations (Tickets #63562 and #42522) on June 29 and July 25, 2025, to avoid unnecessary recalculations of term counts for non-public statuses like 'draft'. Now, it's skipping the call to clean_term_cache() when a draft post with terms is saved.
Tests started failing when updating draft posts with assigned categories or tags. The plugin was not purging term-related cache keys (
rest-term-*) when non-published posts were modified.The following errors:
See issue: #335
The plugin previously relied on WordPress Core to call
clean_term_cache()when terms were updated, triggering the plugin'saction_clean_term_cache()hook. Now we are doing it explicitly for both published and draft posts.✅ Adding rest-term-* keys to purge_post_with_related() for published posts.
❓ Since tests were added in 2023, do we want to keep purging keys for draft posts or should we follow WordPress Core optimisation and also optimize our purging logic.