Save $50 on MainWP Pro!

Manage unlimited sites with no per-site fees. Limited-time offer!

Notice: The Called Constructor Method For WP_Widget Is Deprecated Since Version 4.3.0! Use __construct()

Published on August 27, 2015 by Brendan Carr in MainWP Blog under Tips & Tricks
Heads up: This page may include affiliate links. Read the full disclaimer.

We had an update recently to WordPress 4.3 that caused a few plugins to have some notices displayed on your websites and blogs. This is normal, over time old code and methods of doing things are deprecated, meaning they are “retired” from normal everyday use. The notice actually gave you a LOT of time to fix your code, as these are PHP4 style constructors.

When you get a notice on your screen similar to the one above (which may also refer to WordPress files like pluggable.php), just go to your plugin editor (plugins, editor) and change the following:

$this->WP_Widget(

into something like this (in an upcoming post we’ll talk about why you use the double-colon scope resolution operator in a class)

parent::__construct(

Hit “Update File” at the bottom and if all goes according to plan, your problems are permanently taken care of. At least, until the next plugin update, in which the developer hopefully takes care of the issue also.

construct

3 comments

Comments are closed.

Share

Manage Unlimited WordPress Sites from One Dashboard!

  • Privacy-first, Open Source, Self-hosted
  • Easy Client Management
  • 15+ & 30 + Premium Add-ons
  • Bulk Plugins & Themes Management
Get Pro Now

Categories

Recent Posts

Search MainWP.com

[searchwp_form id="1"]