我也得到了同样的错误,我以这种方式修复了它
class Dokan_Category_Widget extends WP_Widget {
/**
* Constructor
*
* @return void
**/
public function __construct() {
$widget_ops = array( 'classname' => 'dokan-category-menu', 'description' => __( 'Dokan product category menu', 'dokan' ) );
$this->WP_Widget( 'dokan-category-menu', 'Dokan: Product Category', $widget_ops );
}
}
由于以这种方式调用构造函数的方式在 php 7 中被弃用,所以我将调用方式替换为$this->WP_Widget()
parent::__construct()
class Dokan_Category_Widget extends WP_Widget {
/**
* Constructor
*
* @return void
**/
public function __construct() {
$widget_ops = array( 'classname' => 'dokan-category-menu', 'description' => __( 'Dokan product category menu', 'dokan' ) );
//$this->WP_Widget( 'dokan-category-menu', 'Dokan: Product Category', $widget_ops );
parent::__construct('dokan-category-menu', 'Dokan: Product Category', $widget_ops );
}
}