Question

I got this code (simple wordpress plugin).

add_menu_page('Basket Stats', 'Basket Stats', 'manage_options', 'basket_stats', 'basket_stats_plugin_page', '', 71);
add_submenu_page('admin.php?page=basket_stats', 'Basket Stats', 'Basket Stats', 'manage_options', 'basket_stats', 'basket_stats_plugin_page');

First line makes new menu and the second is supposed to make second menu. When I change admin.php?page=basket_stats to something default like tools.php it all works fine. I tried changing it to basket.php (the file that this code is into) but with no effects.

What should I do?

Was it helpful?

Solution

fourth parameter should be FILE, like:

add_menu_page('Basket Stats', 'Basket Stats', 'manage_options', __FILE__, 'basket_stats_plugin_page', '', 71);

everything works after that. It is also possible to change slugs in submenu to FILE too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top