I created my custom RSS feed using the following code:
add_action( 'init', 'MyCustomRSS' );
function MyCustomRSS(){
add_feed( 'examplecomrss', 'MyCustomFeedCallback' );
}
/* This code seeks the template for your RSS feed */
function MyCustomFeedCallback(){
get_template_part( 'rss', 'examplecomrss' ); // need to be in small case.
}
This works well, but I can't seem to disable the cache -- I'm developing the feed and need to see it refreshed when I make changes.
I've tried the following:
add_filter('wp_feed_cache_transient_lifetime', function() {
return 10;
});
// disable feed cache
function turn_off_feed_caching( $feed ) {
// I tried the following line also with no luck
// $feed = fetch_feed( bloginfo_rss('url') );
$feed->enable_cache( false );
}
add_action( 'wp_feed_options', 'turn_off_feed_caching' );
Is the action to disable feed caching somehow different for custom feeds?