我一直收到这个错误时。我正在尝试插入仪表板小部件,但我不知道是什么导致了错误。
警告:call\\u user\\u func()要求参数1为有效回调,在C:\\xampp\\htdocs\\9ja\\wp admin\\includes\\template中找不到函数“voguepay\\u woocommerce\\u payouts\\u dashboard\\u widget\\u display”,或函数名无效。php在线1037
下面是添加小部件的代码
public function register_voguepay_woocommerce_payouts_dashboard_widget(){
add_meta_box(
\'withdraw_to_bank\',
\'Withdraw to Bank\',
\'voguepay_woocommerce_payouts_dashboard_widget_display\',
\'dashboard\',
\'side\',
\'high\'
);
}
public function voguepay_woocommerce_payouts_dashboard_widget_display(){
echo "Hello World, I\'m a great Dashboard Widget";
}
SO网友:Stephen Afam-Osemene
我刚刚找到了解决办法。改用此代码
public function register_voguepay_woocommerce_payouts_dashboard_widget(){
add_meta_box(
\'withdraw_to_bank\',
\'Withdraw to Bank\',
array($this, \'voguepay_woocommerce_payouts_dashboard_widget_display\'),
\'dashboard\',
\'side\',
\'high\'
);
}
public function voguepay_woocommerce_payouts_dashboard_widget_display(){
echo "Hello World, I\'m a great Dashboard Widget";
}