0

I added submenu and admin pages on wordpress custom plugin. But it gives an error.

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wstock_variation' not found or invalid function name.

 add_menu_page('Elites-StockManager', 'Smart Stock Manager', 'export', 'wstock_api_settings', 'wstock_api_connection_settings', '', 7);
    add_submenu_page( 'Elites-StockManager', 'Smart Stock Manager', 'export', 'administrator', 'wstock_variation', 'wstock_variation',8 );

1 Answer 1

2

It seems that your function wstock_variation not exists or is created in PHP file not include in your plugin...

If you are using OOP, for example your code need to be like:

add_submenu_page( 'Elites-StockManager', 'Smart Stock Manager', 'export', 'administrator', 'wstock_variation', array($this, 'wstock_variation') ); // remove number 8, method accept only 6 params

$this is method is not static, in case of static method you need to change by class name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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