Using Transients

I have set set_transient( ‘pgggo_acf_list_transient’, $pgggo_qry, 12 * 7000 ); is that too high? 12 * 7000 is just over 23 hours. Whether or not that’s too high (or low) depends entirely on your specific needs. The expiry time should be based on how often the data needs to be refreshed. What if there is … Read more

WordPress transient not working with WP Engine

So I don’t know why the return $cached_result; in the else, but if that’s intentional, then you should probably do: return json_decode( $cached_result, true ); Because you’re caching the response body (which is a JSON string) and you’re reading the non-cached result like so: $array = json_decode($result, true);. But if that return was a mistake, … Read more

Difference between get_site_transient() and get_transient()

get_site_transient() uses the older nomenclature for multisite which referred to a multisite network as a “site” and individual sites on the network as “blogs”. So get_site_transient() is getting the value of a transient for the whole network, while get_transient() gets a transient for an individual site/blog. If you look at the source of the function … Read more

Compare transient data with a meta box value

I would do the following: Create WP-Cron task (or just use daily wp_scheduled_delete one to tag along) and hook your function to it. In that function: fetch XML file; fetch all posts with meta_weight set, using get_posts(); loop through posts and save comparison result in another meta field for each.

passing markup thought a shortcode attribute

You have quite a bit of markup for that shortcode. Trying to pass all of that as a shortcode is going to be trouble. I pulled it apart to look at it. id=”map” z=”11″ w=”100%” h=”300″ scrollwheel=”false” maptype=”ROADMAP” address=”Southampton, United Kingdom” marker=”true” markerimage=”http://anachronistic.local:9102/wp-content/plugins/_TomRush/inc/js/TinyMCE_additions/modal/../img/icons/music_folk_map.png“ infowindow=”<div class=”marker inside”><img class=”marker icon” alt=”” src=”http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png” /><strong>Southampton</strong><br>Southampton, UK<br><span class=”marker extras”>Some User … Read more

Reset all transients on post or page save

The technical side of it depends on the storage used. For default database storage the transient entries can be queried and deleted, since they have specific naming format. For enabled Object Cache storage cache can be flushed, which will get got cache and transient. The practical side of it — this is Bad Idea. Transients … Read more

Using transient for dynamic css , how to name it?

Unless you do something weird with your settings, transients will just make your code harder to read without adding any measurable performance value. People that want performance should use object caching and page caching and your current code is probably already the best there is to utilize them. Transients will add almost nothing for them. … Read more

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