{"id":11789,"date":"2022-01-27T10:09:28","date_gmt":"2022-01-27T15:09:28","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=11789"},"modified":"2022-01-27T10:09:31","modified_gmt":"2022-01-27T15:09:31","slug":"how-to-stop-wordpress-from-displaying-a-cached-rss-feed","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/how-to-stop-wordpress-from-displaying-a-cached-rss-feed\/","title":{"rendered":"How to Stop WordPress From Displaying a Cached RSS Feed"},"content":{"rendered":"\n
WordPress can be a powerful tool for publishing all sorts of websites with their own content. One of the strengths of WordPress<\/a> is that it is able to pull in content from other websites using RSS. This content can then be displayed on your website. The common problem with this feature is that in most cases WordPress will show a cached RSS feed.<\/p>\n\n\n\n Having cached results in your RSS feed may not be ideal especially when the content is being sourced from a site that has fast-updating posts. So this is something the website owner may want to address.<\/p>\n\n\n\n This can be done by adding action on the Add the following code to the You can use an anonymous function and add a That’s it. The next time you create a new post on your WordPress site the RSS Feed will be cached. For the second example, it will be refreshed after 15 minutes.<\/p>\n\n\n\n Refs: WordPress can be a powerful tool for publishing all sorts of websites with their own content. One of the strengths of WordPress is that it is able to pull in…<\/p>\n","protected":false},"author":1,"featured_media":11791,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,27,16],"tags":[101,320,424,433,449,452,471,591,635,636,638,651],"yoast_head":"\nHow to Fix Cached RSS Feed<\/h2>\n\n\n\n
Disable the RSS Feeds Cache Entirely<\/h2>\n\n\n\n
wp_feed_options<\/code> WordPress hook. This modification will disable caching on the RSS feed.<\/p>\n\n\n\n
functions.php<\/code> file:<\/p>\n\n\n\n
function turn_off_feed_caching( $feed ) {\n $feed->enable_cache( false );\n}\nadd_action( 'wp_feed_options', 'turn_off_feed_caching' );<\/code><\/pre>\n\n\n\n
Change the RSS Feed Cache Refresh Cycle<\/h2>\n\n\n\n
wp_feed_cache_transient_lifetime<\/code> filter that returns the refresh timer in seconds. This example will refresh after 15 minutes (900 seconds):<\/p>\n\n\n\n
add_filter('wp_feed_cache_transient_lifetime', function () {\n return 900;\n});<\/code><\/pre>\n\n\n\n
Conclusion<\/h2>\n\n\n\n
[ 1<\/a> ] – wp_feed_options WordPress Hook
[ 2<\/a> ] – wp_feed_cache_transient_lifetime WordPress Hook<\/p>\n","protected":false},"excerpt":{"rendered":"