Set Transient expiration

The countdown would start as soon as the transient is created or updated. Running set_transient() on an existing transient value will restart the clock. Per the Codex page on set_transient(): If a transient exists, this function will update the transient’s expiration time. According to the Transients API page, the expiration time is the maximum lifetime … Read more

how to get the value of time left for a transient

The problem here is that if the site is actually using something like Redis, or any other supported “external cache” then nothing is going to actually be set in the options table (which can be checked with wp_using_ext_object_cache) Storage in the options table is just how WordPress handles transients outside of any external caching (or … Read more

How to delete transients written by fetch_feed()?

This data should be automatically deleted after 12 hours, that’s the default feed cache TTL. So this kind of house cleaning, for data added by the WordPress transients API, might be unnecessary. But let’s check out what kind of data is stored. If you take for example the feed for your current question: http://wordpress.stackexchange.com/feeds/question/172444 and … Read more

How to purge all transient caches?

Not tested, but if you need a quick and dirty way, you could put a script like this in your WordPress folder and call it each time: define( ‘WP_USE_THEMES’, false ); require(‘wp-blog-header.php’); global $wpdb; $wpdb->query( “DELETE FROM $wpdb->options WHERE option_name LIKE ‘%\_transient\_%'” ); Not to be used on a production server.

Get the timout value of a saved transient?

So, after one minute of more thinking, there is an easy solution, although i did not try it myself: $transient=”_transient_timeout_” . $_your_transient_name; $transient_timeout = get_option ( $transient ); you should be ready to go with this. Another Way throught the database would be: $transient=”_transient_timeout_” . $_your_transient_name; global $wpdb; $query = ‘SELECT option_value FROM ‘ . … Read more

Transient caching for wp query

For my WordPress testimonials widget plugin I’ve successfully used transients with expiration dates to drop page loads by 0.1 to 0.5 seconds. Using WordPress’s own transients is a life-saver. It’s so much easier to package or use straight as needed and then concentrate again on application logic. Rolling yet another caching system is useless. Further, … Read more

How to use transients and variables

You’re saving the data in a loop under the same key for each iteration. You’ll have to add the index of the current iteration of the loop to the key if you want a unique value for each. Something like: $i = 0; while ( have_rows(‘images’) ): the_row(); fragment_cache(‘cms_images_text_’ . $i . ‘_’ . $post->ID, … Read more

Reset Transient on New Day

There is no reliable way to achieve what you want with the Transients API – or even, if you have been considering it, with the WP Cron system. The problem is in a nutshell: Those API systems depend on user input. If you want to know more about it, do a research, as this has … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)