0

I keep getting this error when. I am trying to insert a dashboard widget and I don't know what's causing the error.

Warning: call_user_func() expects parameter 1 to be a valid callback, function 'voguepay_woocommerce_payouts_dashboard_widget_display' not found or invalid function name in C:\xampp\htdocs\9ja\wp-admin\includes\template.php on line 1037

here is the code to add the widget

     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"; 
     }
1

I just found the solution. use this code instead

        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"; 
     }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.