Skip to content

Instantly share code, notes, and snippets.

@CapWebSolutions
Created July 7, 2021 16:17
Show Gist options
  • Save CapWebSolutions/95acafa3f6e409b99509d6d3ec7ba778 to your computer and use it in GitHub Desktop.
Save CapWebSolutions/95acafa3f6e409b99509d6d3ec7ba778 to your computer and use it in GitHub Desktop.
Change RSS feed on main WordPress feed from 12 hrs down to 1 hr. ref: https://wordpress.stackexchange.com/questions/6569/decrease-rss-cache-time-in-plugin Use this in event that external services are not picking up blog posts quickly enough in low traffic sites.
add_filter('wp_feed_cache_transient_lifetime', 'cws_shorten_rss_feed_timeout');
function cws_shorten_rss_feed_timeout( $interval, $url ) {
if( 'https://<example.com>/feed' == $url )
return 3600;
return $interval;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment