I have created a plugin with a top level page. I created a sub menu underneath that. When I run the plugin on my site everything works. But when I test it on a separate site I get an error and I’m not sure why.
This is the the code that is in question and the error that is getting thrown. I can’t for the life of me figure out what the error is from.
function custom_plugin_add_menu_page(){
add_menu_page( 'My Custom Plugin',
'My Custom Plugin',
'manage_options',
'top_level_parent_page',
'top_level_parent_page',
plugins_url( '/my-custom-plugin/includes/images/menu-icon.png' )
);
add_submenu_page(
'top_level_parent_page',
'Custom Submenu Page',
'Custom Submenu Page',
'manage_options',
'custom_plugin_submenu_page',
'custom_plugin_submenu_page_callback'
);
}
add_action('admin_menu', 'custom_plugin_add_menu_page');
and the error:
Warning: call_user_func_array() expects parameter 1 to be a valid
callback, function ‘custom_plugin_submenu_page_callback’ not found or
invalid function name in
D:xampphtdocslocaltestsitewp-includesplugin.php on line 429