Thread Starter
mdxclr
(@mdxclr)
Okay, as I understand this filter is skipped and content is returned from get_cache function – is there a way how can I filter its content?
Hi @mdxclr
If a cache record is present for the current request, it is returned and none of the filters you mentioned are triggered. At this point there isn’t a filter available to filter the cached data, however I think I do understand your use case. I think we can add a filter you could use, however I will have to discuss this with my colleagues first. I will see if we can add such a filter next week and will get back to you!
By the way: because of the way our plugin works (if a cache is present no (normal) plugins are executed) you would have to use this filter from a mu-plugin which is alphabetically before wp-rest-cache.php
Thread Starter
mdxclr
(@mdxclr)
That would be great, if you can add the filter, because filtering it throw get_transient_* is very hard.
@mdxclr We just released a new version of our plugin which includes a new filter wp_rest_cache/filter_cache_output which can be used from a must use plugin that is loaded before our must use plugin (so alphabetically before wp-rest-cache.php).
Thread Starter
mdxclr
(@mdxclr)
Can you also please add to filter some data about request? Request URI or callback function name for example
@mdxclr Isn’t the Request URI something you can get from $_SERVER['REQUEST_URI']? What would it add if we added it to the filter?