How to fix “The called constructor method for WP_Widget is deprecated since version 4.3.0!”

Have you updated WordPress recently to find notices warning you of something related to your Widgets? These notices will show up if you have your site in debug mode (which you should in your local environment, but not on your production website) with the setting in wp-config.php.

Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use

__construct()

instead. in /wp-includes/functions.php on line 3457.

Screenshot 2015-09-17 13.19.49

Here is an example of what you likely have currently in your functions.php file to register your existing widget(s) (in old functions.php on the bottom) and then an example of how to update the widget class with the _construct update (in new functions.php on the top).

Leave a Reply