Make widgets in your plugin compatible for WordPress v4.3

WordPress v4.3 is just a week and half away to be released and it is a major update for developers!

WordPress team being innovative again and deprecated PHP4 style classes in old WordPress, therefor, your plugin is going to show an ugly error in case you use WP_Widget class to show a widget in your website sidebar.

We use hitsteps live support widget and statistics widget in our plugin, so we had to update our codes too and…

Here is what to do!

Open your editor and search for any reference to “extends WP_Widget”

2015-08-09_01-18-49

Your widget class have a name, and most probably (PHP4 style), name of your plugin is used as a function inside of same class. Look here, here’s ours:

2015-08-09_01-22-06

Now, change function name to __construct(). this is new way of defining default function of a class.

And inside of that function, you’ll have a code that call WP_Widget.
It can be parent::WP_Widget, $this->WP_Widget, {something}->WP_Widget… which all are deprecated!

You have to change that to parent::__construct(…);

Here is how it should look like after you done all this changes:

2015-08-09_01-26-15

Number of “extends WP_Widget” lines you have match number of widgets your plugin create. You’ll need to repeat this process for each of them.

Congrats! Your plugin is officially compatible with WordPress v4.3

If you wish to read more about this, you can read this and this from official WordPress team.

We have just released our update for WordPress v4.3 users today, so you can expect a smooth upgrade to new WordPress regarding our analytics service 🙂