PHP 4 Style Constructors Will Be Deprecated in WordPress 4.3

PHP 4 style constructors are being deprecated in WordPress 4.3 to ease the transition to support PHP 7. According to Aaron Jorbin, on the Make WordPress Core blog post, WordPress r32990 introduces a change so that all classes use the PHP 5 style constructors, while still retaining the PHP 4 style constructors for backwards compatibility.

A deprecated_constructor warning that follows the same rules as deprecated_function will also be displayed for WordPress classes that are not external libraries

Chris Christoff, who contributes to WordPress core, generated a list of plugins on the WordPress plugin directory that have widgets calling WP_Widget::WP_Widget() and/or parent::WP_Widget() and/or {object}->WP_Widget().

The list includes more than 4,000 plugins and contains the author, title, and slug. Plugin authors should check the list to see if your plugin is listed. Even if it’s not, you’re still encouraged to make sure you’re not using a PHP 4 style constructor in your code.

If you use any of the plugins listed, please create a support forum thread with a link to the Make WordPress Core blog post and politely ask them to update their plugin.


6 responses to “PHP 4 Style Constructors Will Be Deprecated in WordPress 4.3”

  1. I noticed that a lot since installing 4.3 beta, a lot of the widgets are going to have to be updated most of the ones have $this->WP_Widget() and parent::WP_Widget

        • Yeah, there was just over 4,000 plugins when I generated the list for the first time, including some big ones (Jetpack, and until yesterday, WooCommerce).

  2. Thanks for the head’s up, had one in the list and fixed it immediately (it indeed takes 2 seconds or less to do so)

    • Not a problem. Simple code changes, but it does make a difference :)


Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: