tags:

views:

9

answers:

1

How can I force a refresh when the rss file has been updated? It appears to be caching no matter what...

The feed is located in a WordPress dashboard widget using the simplepie fetch_feed() method...

/* Dashboard Widget */
function my_dashboard_widget_function() { 
    $rss = fetch_feed( "http://mysite.com/feed.rss" );

     if ( is_wp_error($rss) ) {
          if ( is_admin() || current_user_can('manage_options') ) {
               echo '<p>';
               printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
               echo '</p>';
          }
     return;
}
A: 

add_filter( 'wp_feed_cache_transient_lifetime', create_function( '$a', 'return 3600;' ) );

//Where 3600 is the cache duration in seconds.

Scott B