Are transients private or public?

Transients are just database keys that expire. It’s like telling WordPress you want it to remember a certain piece of information, but for a limited time. In general, transients are accessible to PHP through any request. But since they’re server-side, transients are only exposed to front-end users if you as the developer expose them. A … Read more

Is there any danger in deleting all transients?

For development I would advise to always work with WP_DEBUG set to true and do the following: $key = ‘transient_key’; if( !WP_DEBUG && ( false !== ($transient = get_transient($key)) ){ /* Generate transient manually */ $expiration = 24*60*60;//How long to keep for set_transient($key,$transient, $expiration); } In general – it should be fine deleting transients, as … Read more

Cache remote (HTTP) request with Transients API

Catching the weather API remote data The msg, you’re showing in your question is basically the result from the weather API. And it says, that there’s no data available for your location. The first thing you want to do is some research in the Codex and the “WP HTTP API”. The right/WP way to grab … Read more

When should I be using the Transients API?

Transients are great when you’re doing complex queries in your themes and plugins. I tend to use transients for things like menus and showing other things like Tweets from Twitter in a sidebar for example. I wouldn’t use them for absolutely everything more-so just temporary pieces of data that can be cached. Keep in mind … Read more

Should I use Transient API to store HTML String, or Object?

Should I use Transient API at all here? No. In a stock WordPress install transients are stored in the wp_options table, and only cleaned up during core upgrades. Suppose you have 50,000 posts, that’s 50,000 additional rows in the options table. Obviously they’re set to autoload=no, so it’s not going to consume all your memory, … Read more

How does object caching work?

WordPress, by default, does a form of “Object Caching” but its lifetime is only a single page load. Options are actually a really good example of this. Check out this answer for more info. The summary: A page starts All options are loaded with a simple SELECT option_name, option_value from $wpdb->options statement Subsequent requests for … Read more

Are transients garbage collected?

They now are Starting with WordPress 3.7 expired transients are deleted on database upgrades, see #20316 Old answer If someone can’t show me otherwise it seems that transients are not garbage collected after all. What makes it worse is that unlike options they are not guaranteed to be stored in database. So there is no … Read more

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