The example your using from the codex adds and removes it (probably not something you want to do), and is not very clear.
By default WordPress will cache the feed for 12 hours using wp_feed_cache_transient_lifetime
, the actual code WP uses for 12 hours is $lifetime = 43200
If you want to alter the cache time globally for all simplepie feeds, you can add new time to the filter,
//change cache to 24hrs
add_filter( 'wp_feed_cache_transient_lifetime', create_function('$a', 'return 86400;') );
If instead you want specific feeds to have different cache times, you can use the $url
parameter in the filter.
add_filter( 'wp_feed_cache_transient_lifetime', 'change_feed_speed' );
function change_feed_speed( $lifetime, $url ) {
if( 'http://mysite.org/some-feed.rss' == $url )
return 86400;
return $lifetime;
}
Related Posts:
- How do I fetch feed info from cache instead of directly from feed?
- Feed cache fallback – A feed could not be found
- W3 total cache – cache refresh programmatically [closed]
- Should I use Transient API to store HTML String, or Object?
- Caching: APC vs APCu vs OPcache
- Pros and Cons for high “expire time” on wp-super-cache or w3-total-cache? [closed]
- Limit cache size from W3 Total Cache [closed]
- Does a query executed through wpdb class get cached?
- Configuring WordPress for Amazon CloudFront Caching?
- Caching: Force fresh content for logged-in users (potentially by adding a query variable to the URL)
- Will I see a performance hit if I use native API calls like get_the_title() instead of $post->post_title?
- WordPress Browser Cache with W3-Total-Cache doesn’t show new posts [closed]
- Nginx + WordPress + HHVM: Why isn’t Batcache working? Would Varnish help even more?
- Does a low traffic WordPress site need a caching plugin and a CDN
- Automatically Refresh WordPress Stylesheet
- Can I force get_option to go back to the DB instead of cache?
- How to purge all transient caches?
- Writing a cache manifest file for a WordPress blog (app cache, offline web applications)
- How to force content refresh of a page that has been loaded previously by the user? [closed]
- Help Pinpointing Source of Caching Issue
- How to clear cache without a plugin [closed]
- Can someone explain WordPress caching, and what’s the best in my scenario?
- Transient / object cache maximum key length [duplicate]
- APC object caching in combination Batcache/memcached page caching?
- WordPress caching in development
- What is difference between ‘Page Cache’ and ‘Object Cache’ in WordPress?
- W3 total Cache – Site with query strings
- Programmatically insert hierarchical terms & set terms for post causes glitch? [duplicate]
- Getting soft 404 errors (200 status) when caching plugins are enabled
- How to totally disable cache in WordPress?
- Database Cache and Object Cache Difference?
- How to purge all transient caches?
- W3 Total Cache plugin integration
- When use a cache system with WordPress
- Method to make definitively static an abandoned WP blog
- pass-protected pages and posts not protected after enter them 1 time
- Static HTML page caching for large website [closed]
- WordPress caching issue
- WP Super Cache Bug with Ubermenu
- Problem with caching, W3TC [closed]
- How to find time last viewed?
- WP Rocket Cache Lifespan – Never clear cache? [closed]
- Disable feed cache for custom RSS feed?
- How do I enable dynamic content in a theme cached with WP Super Cache?
- How to cache a different page version based on HTTP header?
- Live website is not showing the changes I’ve made [closed]
- After having installed APC Object Cache Backend transients stopped working
- WebHostingBuzz cache statement
- Are get_bloginfo queries cached to start, or should they be cached?
- W3 Total Cache can’t create files [closed]
- Files cached as CSS or PHP?
- Is it duplicated if I cache an object that uses data from postmeta?
- How to clear user’s browser cache after publishing a new post?
- A bunch of unrelated wordpress using same memcached don’t store correctly their datas
- Combile External JS files using W3 Total Cache [closed]
- RSS: fetch_feed caching with different caching delay per feed?
- How to be sure to get last page version without ANY cache?
- Is there a limit to size of data stored in update_option()?
- How can I cache font files on WordPress [closed]
- W3 total – leverage browser caching not working with cdn delivered images [closed]
- Browser cache for dynamic content (list of tags)
- How to specify expiration of cacheable resources? [closed]
- Scheduling doesn’t work due to caching?
- APC fragmention woes on Apache AWS EC2 Small instance with WordPress and W3TC [closed]
- w3 total cache – Object Caching 2165/2469 objects? [closed]
- Website working fine when logged in but not working fine when we logged out
- Changing WP Object Caching during runtime
- Best practices for the cache of a static WordPress site, including CDN Cache and Cache Plugin
- Site’s first loading on a new browser with no cache is messed up
- Site speed slows when user logged in
- WordPress mobile version is not responsive anymore after installing varnish
- Admin area is caching posts in the editor
- WordPress on mobile devices with new data after updating page
- Having issues fixing site speed
- Is there a way to cache WordPress that does not loads core?
- Need to refresh page after each change
- leverage browser caching in wordpress
- WordPress varnish pages printed twice
- WordPress Userroles button getting cached
- FATAL ERROR – white page – no site showing
- How to let users clear their posts cache with WP Super Cache?
- Having 4000 posts, my site is so slow
- GravatarLocalCache Plugin Broken in WordPress 4.2
- Super cache caches mobile pages for desktop
- Should I use transients for these API call results?
- My website resets when accessing the index page
- Debug Performance Issues
- cache reset button and question about deleting cache
- Cleared wp-cache and file is still not updated [closed]
- Bluehost WebHost and performance problems with W3TC [closed]
- get_theme_mod returning cached values regardless of apache restart
- Caching with dynamic content
- Levels of caching and impact on the WordPress web site
- CSS changes not taking effect [closed]
- what is the cache directory for in my theme? (version control it?)
- WP 3.5 caching problem
- Multiple WordPress sites eat up a lot of RAM
- Convert WordPress to static website by using the pages generated by the caching plugin?
- How I define max cache time to Google Fonts installed on my site
- Keeping Objects in Memory