Problem When Using Object Caching
-
I have been running into an issue that occurs when CPT-onomies is used on a site that has object caching enabled. This is a pretty big issue as it basically breaks the plugin.
Also, I should add that the problem occurs when terms are requested more than once per runtime.
Here is what happens with object caching and multiple requests for CPT-onomies:
- Terms queried via
get_the_terms() - It is the first run so the object cache is empty.
wp_get_object_terms()is ran wp_get_object_terms()queries the database and doesn’t find anything, populates object cache with blanks/errors- CPT-onomies hooks at the end of
wp_get_object_terms()and does its own querying, returns “correct” results get_the_terms()returns correct results
On the first run, all is fine. However, if a second run is triggered:
get_the_terms()checks object cache (relationships) which isn’t empty anymore- Runs
get_term()on each term. Because the terms don’t actually exist in the database, the function returns a Invalid Term error - Returns the error, never runs
wp_get_object_terms()and thus never runs the CPT-onomies filters
It is basically impossible to use the plugin in this particular scenario.
- Terms queried via
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Problem When Using Object Caching’ is closed to new replies.