Created
September 17, 2015 17:25
-
-
Save circlecube/79e24f51639912dd9dfd to your computer and use it in GitHub Desktop.
How to fix "The called constructor method for WP_Widget is deprecated since version 4.3.0!"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
class My_Widget extends WP_Widget { | |
function __construct() { | |
parent::__construct( | |
'my-widget', // Base ID | |
'My Widget', // Name | |
array( 'description' => 'My Widget description.' ) // Args | |
); | |
} | |
function widget($args, $instance) { | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
class My_Widget extends WP_Widget { | |
function My_Widget() { | |
$widget_ops = array('classname' => 'my-widget', 'description' => 'My Widget description.'); | |
$control_ops = array('id_base' => 'my-widget'); | |
$this->WP_Widget('my-widget', 'My Widget', $widget_ops, $control_ops); | |
} | |
function widget($args, $instance) { | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment