After updating WordPress to 4.3 (“Billie”), I received the following notice;
Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use
__construct()
instead. in /../../functions.php on line 3457
This notice appears if a plugin or theme file uses a PHP4 constructor. The message will only show if you have debug set to true in your config file.
[Solved] WP_Widget is deprecated since version 4.3.0
My error was actually in some widget include files, rather than in the functions file cited by the notice.
After backing up your files, do a search in your theme files for;
$this->WP_Widget
and change that to;
parent::__construct
This should remove the WP_Widget is deprecated error notification.
After several hours of searching and not getting very far I came across your solution to this vexing problem and was able to resolve it quickly and easily.
Thank you so much!
I have searched and search but I still would not get where the error is from. What else can I do?
If you enable error reporting via the cms, you should be able to find error messages in the system.log and exception.log files in your var/ folder.
No problem, I’m glad it helped!
Thanks for your helpful advise. Do you know will this code change will work on files in the plugins folder?
When I search for $this->WP_Widget I find it in plugins associated with Adsanity and Gravity forms.
Cheers, Ginger
Hi Ginger,
I’d advise trying to get the latest versions of these plugins, as the change was made by WordPress quite a few versions (4.3.0, latest version is 4.4.1), so the plugins should have been modified since. If the plugins are no longer supported or embedded within themes, you may have to manually make the change (after saving a backup).
Let me know how you get on.
Andrew