0
我下載了一個我非常喜歡使用的Wordpress插件。唯一的問題是它在調試過程中拋出一個廢棄的錯誤,以便使用WP_widget。WordPress插件'WP_widget'已棄用,如何解決?
注意:從4.3.0版本WP_Widget在SteamApiWidget被叫構造方法已過時!改爲使用 __construct() 。在行3770
因此,我做了一些搜索,但不幸只是取代'WP_widget''__construct()'只設法打破插件。這就像我的編碼知識一樣。我發現'WP_widget'的兩個實例在下面。我需要更改哪些內容以使其符合當前的PHP標準?
/**
* Class SteamApiWidget
*/
class SteamApiWidget extends WP_Widget
和
/**
* @constructor
*/
public function __construct()
{
$this->initPluginConstants();
$widget_option = array(
'classname' => PLUGIN_SLUG,
'description' => __('A simple WordPress widget for your steam profile.', PLUGIN_LOCALE)
);
$this->WP_Widget(PLUGIN_SLUG, __(PLUGIN_NAME, PLUGIN_LOCALE), $widget_option);
$this->registerScriptsAndStyles();
}
這就像一個魅力。非常感謝你! – TigerXtrm
很高興聽到它! – Katie