set_transient and get_transient – does not work for me
-
Hi!
I want to try out the set and get_transient functions. As an example I used my tag_cloud which is generated randomly on every page request. I set the timeout to 10 seconds but it does not seem to work.
What am I doing wrong?
// Get any existing copy of our transient data // delete_transient('special_query_results'); $special_query_results = get_transient('special_query_results'); // If it wasn't there regenerate the data and save the transient if (!$special_query_results) { echo "<!-- caching -->"; $special_query_results = wp_tag_cloud(array( 'smallest' => 8, 'largest' => 16, 'number' => 30, 'order' => 'RAND', 'echo' => false )); set_transient('special_query_results', $special_query_results, 10); } echo $special_query_results;
- The topic ‘set_transient and get_transient – does not work for me’ is closed to new replies.