Opens in a new tab

Save $50 Every Year with MainWP

Get $50 off the MainWP Yearly Plan this Black Friday. Your discount renews every year! Claim Your $50 Discount
← Back to blog

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

This post may contain affiliate links. Read the disclosure.

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

Explore MainWP Pro
Get MainWP Pro
Topics: Tips & Tricks

3 comments

Comments are closed.