I would like to add parameter for the submenus, but when I click to the admin page I receive the following message:
You do not have sufficient permissions to access this page.
Code:
add_submenu_page(
'sandbox',
'Sandbox Options',
'Options',
'administrator',
'sandbox_options&tab=4',
'sandbox_options_display'
);
Without &tab=4 everything is okay.
You’d have to manipulate the global
$submenu
and modify the link in it. Or use jQuery.The following example adds a submenu in the Dashboard menu and changes the destination link just after. The submenu page will dump the contents of the global var.
[Update]
The example given, Redux Framework, uses the following technique:
Add a menu page with a slug
example_slug
.Add the submenu pages and use the same slug
example_slug
+&tab=N
.All the menu and submenu pages are rendered with the menu callback. The submenu have
null
callbacks.Example:
Basically you need to reconstruct the url, because
plugin_basename
will strip your extra query args after you register the page with query args.Full (working/tested) solution follows:
I solved it like this: