Is there any danger in deleting all transients?

I have a big site for a client, and as it is a really customized wordpress installation with lots of extensions on functionality, I can’t use the caching plugins.

To improve the performance, I built a lot of the Site using transients (for example the navigation, the google maps with all the markers etc.), and leave the dynamic content dynamic.

Read More

The problem here is if I change anything, I have to manually delete the specific transient to see the current result. The site shows different menus and googlemaps when entered from a different channel, so I have like ten transients for each area.

Would you create a function where I delete those all at once (with a listing of the names of the transient), or is it okay to just delete all the transients on the site?

It’s not really that urgent, but for future ddevelopment I would like to know if you had any problems with stuff like that, and how you manage all your transients.

Cheers,
fischi

Related posts

Leave a Reply

3 comments

  1. 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 they should never be assumed to be in the database.

  2. You should be hooking the various actions that run when things are updated to clear out and refresh transients. For example, when the nav menu is updated, the wp_update_nav_menu action is fired, hook a function to that to refresh your nav menu transient.

  3. Would it not be better to do your development on a development environment so that the need to see your changes as they are made doesn’t impact the public site?

    Using this approach you could then deploy/promote to production and flush the transients at a low traffic time with minimal impact to site performance and user experience.