Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am working on a plugin (widget) that is using some transients that are updated from time to time.

That said, when these transients are updated, I think I will need to flush the cache to display the new data properly.

Thus, I wonder if have some way to flush the cache only for widget instead of entire cache. Do you guys have some advice?

share|improve this question

1 Answer 1

if you want to flush the specific cache you can do that: the plugin has functions for that

<?php
flush_pgcache();  // Page cache
flush_dbcache();  // Database cache
flush_minify();  // Minify cache
flush_all(); // All caches
?>

and you just need to call it like this:

<?php 
$w3_plugin_totalcache->flush_all();
?>
share|improve this answer
1  
Hey, thanks for your reply. However I was not planning to flush entire cache. I wonder if is possible to flush just the widget area. Do you have any ideas? –  Tiago Hillebrandt Jan 8 at 19:11
    
There was no option/function available to flush widget cache. You have to flush_pgcache(); or flush_dbcache(); based your needs. –  palPalani Jan 13 at 13:19
    
Hey, looks like it is possible to do what I need using Fragment Caching :) Thanks for the help! –  Tiago Hillebrandt Jan 26 at 5:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.