--- a/wp/wp-includes/feed.php Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/feed.php Wed Sep 21 18:19:35 2022 +0200
@@ -789,7 +789,6 @@
require_once ABSPATH . WPINC . '/class-simplepie.php';
}
- require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
require_once ABSPATH . WPINC . '/class-wp-feed-cache-transient.php';
require_once ABSPATH . WPINC . '/class-wp-simplepie-file.php';
require_once ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php';
@@ -797,11 +796,20 @@
$feed = new SimplePie();
$feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
- // We must manually overwrite $feed->sanitize because SimplePie's
- // constructor sets it before we have a chance to set the sanitization class.
+ // We must manually overwrite $feed->sanitize because SimplePie's constructor
+ // sets it before we have a chance to set the sanitization class.
$feed->sanitize = new WP_SimplePie_Sanitize_KSES();
- $feed->set_cache_class( 'WP_Feed_Cache' );
+ // Register the cache handler using the recommended method for SimplePie 1.3 or later.
+ if ( method_exists( 'SimplePie_Cache', 'register' ) ) {
+ SimplePie_Cache::register( 'wp_transient', 'WP_Feed_Cache_Transient' );
+ $feed->set_cache_location( 'wp_transient' );
+ } else {
+ // Back-compat for SimplePie 1.2.x.
+ require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
+ $feed->set_cache_class( 'WP_Feed_Cache' );
+ }
+
$feed->set_file_class( 'WP_SimplePie_File' );
$feed->set_feed_url( $url );