Set transient with get posts error

If what you want is for this function to run once a day and loop through all matching posts (removing img tags), I think this should do the trick: <?php function remove_images_form_past_posts() { if ( get_transient(‘images_removed_from_past’) ) return; $args = array( ‘post_type’ => ‘post’, ‘year’ => 2013, ‘monthnum’ => 1, ‘day’ =>28, ‘post_status’ =>’publish’, ‘category’ … Read more

Set_Transient to end at midnight

Do you just want this lines ? $midnight_time = strtotime(‘tomorrow’) – time(); set_transient( ‘transient_name’, $transient_datas, $midnight_time); $midnight_time represent the seconds before midnight happens. You can ask your server to curl a page with a random parameter if you have cache to be sure your transient is consumed with a cronjob.

delete_transient on click inside a widget form

I assume the widget and the “Refresh now” button are shown on the front-end, yes? One option to delete a transient is to use ajax to do it. This is rather rough example, but I hope it gives you the idea what to do. You can read more about Ajax in WordPress from the codex. … 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

Synchronize Data every minute with set_transient

To my understanding, *_transient() is basically *_option() wrapped in a cache-timer. What that means in this context, is that set_transient( ‘…’, true, * MINUTE_IN_SECONDS ); will not run/re-evaluate every minute. Instead it will run/re-evaluate when the page has loaded by a visitor/user, and the data therein is older than 60 seconds. This is not ideal … Read more

How many transients is too many transients

It depends if you add an expiration time. If you do not add an expiration time then autoload will be yes. This means the option that stores this transient will be loaded on every request even if it’s not used. With large numbers of transients this poses an issue purely in terms of memory. I … Read more

Why Transients may not work correctly?

By the definition and the usage pattern, transients might be deleted at any point in time, the expiry time parameter really specifies only the maximal time the value will be cached. It might be that the particular site has a problem with transients not being cleaned on time and employs some code to clean them … Read more

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