WordPress.org

Forums

Weather Underground
[resolved] Cache re-load time (3 posts)

  1. gezginrocker
    Member
    Posted 1 year ago #

    Hi,

    I've read that if we enable cache, results are re-loaded every 6 hours.

    Is it possible to increase re-load time? For example, is it possible to re-load every 24 hours?

    Thanks

    https://wordpress.org/plugins/wunderground/

  2. gezginrocker
    Member
    Posted 1 year ago #

    I think I found the answer, so I'm sharing it.

    At the line 494 of wunderground.php, there is this code:

    set_transient($transient_title, $table, apply_filters('wp_wunderground_forecast_cache', 60*60*6));

    I changed 60*60*6 to 60*60*24, so now I think it is updating the cache once in 24 hours.

    Hope it helps...

  3. Zack Katz
    Member
    Plugin Author

    Posted 10 months ago #

    The new version (2.0) only caches the data for 1 hour by default. If you want to change that, add the following code to your theme's functions.php file:

    add_filter('wunderground_cache_time', 'modify_wunderground_cache_time');
    
    function modify_wunderground_cache_time( $previous ) {
        // Change 24 to however many hours to cache for
        return HOUR_IN_SECONDS * 24;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Weather Underground
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.