Skip to content

Fix SimplePie set_file_class() deprecation warning in init_feed() #1205

@poonam279

Description

@poonam279

Description

PHP Deprecated: "SimplePie\SimplePie::set_file_class()" is deprecated since SimplePie 1.3,
please use "SimplePie\SimplePie::get_registry()" instead.
in /wp-includes/SimplePie/src/SimplePie.php on line 1167

Root Cause

File: includes/abstract/feedzy-rss-feeds-admin-abstract.php
Line: 861
Method: init_feed()

$feed->set_file_class( 'WP_SimplePie_File' );

This calls the deprecated set_file_class() API on the SimplePie instance. WordPress 6.3 upgraded its bundled SimplePie to v1.8+ (using the SimplePie\SimplePie namespace), which now actively emits a PHP deprecation notice for this method. The modern replacement is get_registry()->register('File', 'WP_SimplePie_File').

Suggested Fix

In init_feed(), replace line 861:

// Before (deprecated)
$feed->set_file_class( 'WP_SimplePie_File' );

// After (modern API)
$feed->get_registry()->register( 'File', 'WP_SimplePie_File' );

Note: get_registry() has been available since SimplePie 1.3. Since the plugin already requires WP 6.0+ (which bundles SimplePie 1.5+), no backward-compatibility guard is needed.

Step-by-step reproduction instructions

  1. Install plugin on WordPress 6.3+
  2. Add define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); to wp-config.php
  3. Load any page that renders a feed shortcode, widget, or block
  4. Check wp-content/debug.log — the notice appears on every feed fetch

Screenshots, screen recording, code snippet or Help Scout ticket

https://secure.helpscout.net/conversation/3274418802/486108

Environment info

No response

Is the issue you are reporting a regression

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis label could be used to identify issues that are caused by a defect in the product.customer reportIndicates the request came from a customer.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions