WordPress 6.4.2 running Twenty Twenty-Four theme.
I am able to control the refresh interval of a feed in a RSS Block using a code snippet without any problem:
function return_cache_time( $seconds )
{
// change the default feed cache recreation period to 10 minutes
return (int) 600;
}
// adds the filter to set cache lifetime
add_filter( 'wp_feed_cache_transient_lifetime' , 'return_600' );
$feed = fetch_feed( $feed_url );
// remove the filter to reset the cache lifetime to default value
remove_filter( 'wp_feed_cache_transient_lifetime' , 'return_cache_time' );
I now want to record the actual time that the refresh took place (as a shortcode so I can put it on the page next to the Block).
Looking for suggestions as to how this might be achieved?
Thoughts: Not tried anything yet as I have no idea where to start but AFAIK WordPress does not consider a page as modified when only the RSS is refreshed. I think the answer may have something to do with SimplePie.