Articles of transient

How to clear Transients on all sites in Multi Sites environment

I know we have the following command available in WP-CLI to remove transients # Delete all transients $ wp transient delete-all However, my question is does it remove transients on all sites over multi sites? If not how can we remove transients on all sites?

is_wp_error() and handling errors

Im trying to build a function which grabs the feedburner “readers” using wp_remote_get(). I noticed that it frequently returned a value of 0. I assumed at first that it was a WordPress error (handled by is_wp_error()) or a flaw with wp_remote_get(). Wrong of-course.. Feedburner just kept crashing, so I used a second transient to store […]

What to use , set_transient, set_option or file system?

I have a shortcode that can parse page contents. For example you give it a link to a GitHub md file , it reads it and saves the page content for you. $parse_atts = array( ‘id’ => $id, ‘url’ => $url, ‘days’ => $days, ‘hours’ => $hours, ‘markdown’ => $markdown, ‘escaped’ => $escaped, ‘mdengine’ => […]

Messing up with transient API – getting flushed on refresh

Following the _s theme I wanted to make my own version of Post Categories List with Transient, and here’s what I made: function my_blog_categories() { global $post; if ( ( $get_post_categories = get_transient( ‘this_blog_categories’ ) === FALSE ) ) { $get_post_categories = get_the_category_list( ‘ | ‘, ”, $post->ID ); set_transient( ‘this_blog_categories’, $get_post_categories ); } return […]

WordPress Caching – Transients API or “update_user_meta ” Cronjob?

I’m trying to set user meta based on queries. Basically, things like IF the query returns true, set this or if not, set this (or don’t set it, if it is true). This works great but the problem is I currently make the call EVERTYIME to check true or false which I know is bad […]

How does WordPress handle sessions?

I know that WordPress is stateless and doesn’t use any global session variables, but when a user logs in via WordPress, it must somehow keep track of who is logged in, right? Does WordPress keep track of that in cookies? I’m working on a plugin that must keep track of something similar. I can easily […]

How to delete transients written by fetch_feed()?

I’m using fetch_feed() to cache external rss sources displayed in a widget. in case the widget (or, more likely, the whole plugin) is deleted/deactivated, i want to manually delete all related transients. In class-feed.php $filename is passed to the constructor of WP_Feed_Cache_Transient{}, which obviously handles the transients for fetch_feed. I just havent figured out how […]

How to cache posts based on $_GET? Option name is too long? Options / transients

I have a search feature set up that is fairly expensive and I want to cache the results, based on the $_get string, like: ?search_type=product&relation=or&date=all&s=tagsearch&merchcat=cotton&brand=brandx&color=blue&etc=morestuff So, i’m trying to cache the array of posts that I get: if (false === ( $products = get_transient($name) ) ) { $products = getproducts(); set_transient($name, $products, 60*60*12); } for […]

Transient API and caching Plugins

Hello wordpress NINJAS…. I am crazy about transient api and I have implemented it in my theme.My question is If I use transient api is it required caching plugin? (I hate plugins!!!) If I use transient and caching ,how will be the result? Can I use transient against caching plugin? Is caching plugin and transient […]

Transients vs CRON +Custom Fields: Caching Data Per Post

Wanted some opinions on a solution I’m trying to come up with: I have a fan/enthusiast plugin I’m working on for fans of TV shows. One of the custom post types attached to the plugin is a release type which stores data on dvd releases of a show. Some of the meta data that I […]