I get messages in the debug.log for PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; WP_RSSjb has a deprecated constructor in /home/dccomp/competitions.com/wp-content/plugins/rss-just-better/RSS-just-better.php on line 57.

How can I modify this? The line is

class WP_RSSjb extends WP_Widget {

 * Widget setup.
function WP_RSSjb() {
 /* Widget settings. */
$widget_ops = array( 'classname' => 'rssjustbetter', 'description' => __('A customizable list of feed items given: URL and number of displayable items. Also available as shortcode. Compatible with RSS vers. 0.91, 0.92 and 2.0 & Atom 1.0.', 'RSSjb') );

/* Widget control settings. */
    $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'rss-just-better' );

/* Create the widget. */
    parent::__construct( 'rss-just-better', __('RSS Just Better', 'RSSjb'), $widget_ops, $control_ops );

Thanks for your help.


Change function WP_RSSjb() { to function __construct() {. See PHP: Constructors and Destructors.

  • This change will be reverted if/when a new version (or even the same version) of the plugin is installed. OP should contact the plugin author and tell them to update the plugin to use a PHP >5 constructor. – Andy Nov 19 '17 at 11:45
  • Also, whilst not strictly necessary it’s good practice to prefix the declaration with its visibility e.g public – Andy Nov 19 '17 at 11:46
  • 1
    The plugin hasn't been updated in over 2 years. The issue was posted on the support forums over a year ago. – Nathan Johnson Nov 19 '17 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.