Answer the question
In order to leave comments, you need to log in
How to cache the executed part of php code?
Hello, I'm struggling with the problem of long site loading on WP, the bottleneck is in the loop (~ 1500 iterations) the register_taxonomy function is executed - it creates a PHP class object.
Is it possible to somehow cache this moment? Those. the result of executing a function or a complete loop?
Answer the question
In order to leave comments, you need to log in
You can't cache the loop, of course, but the result can be, for example, using serialize(), if there really is an object.
It seems to me that you are looking for wp_cache_set()
and wp_cache_add()
, but wp_cache_get()
in order to receive data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question