[wp-trac] [WordPress Trac] #63717: `fetch_feed()` fails to data stored in transients.

WordPress Trac noreply at wordpress.org
Thu Jul 17 23:33:59 UTC 2025


#63717: `fetch_feed()` fails to data stored in transients.
--------------------------------+-----------------------------
 Reporter:  peterwilsoncc       |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  External Libraries  |    Version:
 Severity:  normal              |   Keywords:
  Focuses:  performance         |
--------------------------------+-----------------------------
 Since the SimplePie upgrade in r59141 / [https://github.com/wordpress
 /wordpress-develop/commit/ebfb7649ca168d585eda8be789db3817c439c585
 ebfb7649ca16]

 The `fetch_feed()` function is intended to store a cache of the feed in a
 transient and use the data for 12 hours.

 Since the upgrade the data is being stored as a transient but fails to
 make use of the data in subsequent requests to the feed. This results in
 each request to a website making use of the RSS block re-requesting the
 data on each page load.

 Reviewing the database, it appears the data is stored in a transient but
 the transient is ignored. The following test demonstrates the issue:

 {{{#!php
 <?php
 /**
  * Ensure that fetch_feed() is cached on second and subsequent calls.
  *
  * @group feed
  *
  * @covers ::fetch_feed
  */
 public function test_fetch_feed_cached() {
         $filter = new MockAction();
         add_filter( 'pre_http_request', array( $filter, 'filter' ) );

         fetch_feed( 'https://wordpress.org/news/feed/' );
         $this->assertSame( 1, $filter->get_call_count(), 'The feed should
 be fetched on the first call.' );

         fetch_feed( 'https://wordpress.org/news/feed/' );
         $this->assertSame( 1, $filter->get_call_count(), 'The feed should
 be cached on the second call.' );
 }
 }}}

 Note: when added to the test suite, this should be placed in the
 `external-http` group.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63717>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list