Hi @limegrow
Thank you for using our plugin!
I would start with the set_cache(...) function in includes/caching/class-caching.php. Somehow the transient isn’t set (correctly).
Thanks! We’ll dig in. ๐
Hi again!
What I’ve noticed now is that the headers are different between local development and live server. Live server does not cache, local caches.
Are you able to tell if there are any red flags between the response Headers that could cause that? If not, then we’ll dig deeper.
Left = Local = Cache works
Right = Live = Cache does not work
View post on imgur.com
@rockfire
Update here: Does not seem like Headers have anything to do with it.
When doing Posts requests up to 30 per_page, it works. Going higher starts to cause the expired issue.
Examples that still cache:
- /wp-json/wp/v2/posts?per_page=1
- /wp-json/wp/v2/posts?per_page=10
- /wp-json/wp/v2/posts?per_page=30
But this gets immediately expired:
- /wp-json/wp/v2/posts?per_page=40
Update:
Nailed it down to specific posts that are in the output. With ?per_page less than 40 it just happened that the specific post did not appear in the JSON output and thus all was good.
Currently it seems that we have a post with ID 91, and when this post is asked individually (/wp-json/wp/v2/posts/91), it also gets expired immediately.
No errors are shown regarding that post so still no clue why (debug mode is on) it gets expired.
@limegrow Wow, you did some real digging!
Is there any chance you could send me the response of the individual call (/wp-json/wp/v2/posts/91)? Either here or via email plugins <at> acato <dot> nl
I want to see if there is something in the response that might be causing this.
@rockfire that was just the beginning. ๐
I’ll send you an email soon.
I’m having the same issue with one of my company product blogs but I am no WP expert to assist debugging. I’m following closely this thread and looking towards your findings and solution.
Hi @thanhttran
Thank you for using our plugin!
Via email we have had some contact with @limegrow and the cause of his problem was found in the collation of his database tables / columns. This caused WordPress to be unable to save records (transients) with certain characters in it (in this specific case: ๐ ). Unfortunately this is an issue with the database / WordPress and not something we can solve.
Having said that, I have no way of knowing if your issue is the same. But if you are using any special characters try removing them to test if that solves the issue. If it doesn’t help could you please send me the JSON response from the WP REST API for that specific product blog? Either here or via plugins <at> acato <dot> nl. Maybe I can find what is causing your issue.