BWP using deprecated constructor
-
Upgraded to 4.4 and getting the following error:
Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use
__construct()
instead.
When I deactivate the plugin the error message goes away. I tried to find the error in the code but could not.
-
Hi there,
That’s a known issue and will be fixed in the next version.
If you want to use the current version, you can change the following line: https://github.com/OddOneOut/bwp-recent-comments/blob/master/includes/class-bwp-rc-widget.php#L12
to
function __construct()
and it should work.
class BWP_RC_Widget extends WP_Widget { function BWP_RC_Widget() { $widget_ops = array('classname' => 'bwp-rc-widget', 'description' => __( 'Show a list of recent comments/trackbacks generated by the BWP Recent Comments plugin.', 'bwp-rc') ); $control_ops = array('width' => 350); $this->WP_Widget('bwp_recent_comments', __('BWP Recent Comments', 'bwp-rc'), $widget_ops, $control_ops); }Won’t that overwrite the class BWP_RC_Widget and give me a different error
No you only have to replace line 12 (should be highlighted in the link I posted above).
I replaced function BWP_RC_Widget() with function __construct() and still get the same depreciated error message
Sorry for my late reply.
That’s weird, I’ve applied the patch and it’s working for me: https://github.com/OddOneOut/bwp-recent-comments/commit/379d9b6513d75fa455f890dcf51e2e9b6f8348f2
The topic ‘BWP using deprecated constructor’ is closed to new replies.