Add support for flushing term cache when objects terms are modified - #28
Closed
MosheGross wants to merge 3 commits into
Closed
MosheGross wants to merge 3 commits into
MosheGross wants to merge 3 commits into
Conversation
MosheGross
marked this pull request as draft
January 28, 2026 13:33
MosheGross
marked this pull request as ready for review
January 28, 2026 13:33
Contributor
Author
|
@richardkorthuis can you have a look pls |
richardkorthuis
pushed a commit
that referenced
this pull request
Feb 25, 2026
Collaborator
|
Hi @MosheGross Sorry for the late reply, but I finally had time to check your PR. I am going to close your PR, not because I don't like it, but because I have implemented your changes with some small improvements, for instance some code that didn't completely adhere to the WP Coding Standards and also I made the Thank you for your contribution! |
Contributor
Author
|
@richardkorthuis amazing, thanks |
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.
As of now, lets say i query
/wp-json/wp/v2/categoriesI get back the count for each category (and by default it also hides empty categories).
If I add a post or edit a posts category, the counts should change, but they don't.
So I added function to hook into
set_object_terms.I added the filter
wp_rest_cache/flush_on_set_termsand defaulted it tofalsefor performance, as the function is quite heavy, it has to do the following