Reputation: 471
I need to create a new menu and a sub menu item for the wordpress administrators. The menu is working fine but the sub menu items ( a duplicate sub menu for the main menu item is being created automatically.. I don't want that ). Both the sub menu items has their href attribute blank. I don't understand what the menu slug is. Please help..
// create custom plugin settings menu
add_action('admin_menu', 'retail_create_menu');
function retail_create_menu() { //create new top-level menu
add_menu_page('Retailers', 'Retailers', 'administrator', __FILE__, 'generate_retailer_list', 'http://localhost/apsm/wp-content/themes/wp-mediamag/functions/retail.ico');
add_submenu_page( __FILE__, 'Add Retailers', 'Add Retailers', 'administrator', 'add_ratilers.php', 'retailer_submenu_callback');
}
The file are inside a folder in my theme...
Upvotes: 0
Views: 4653
Reputation: 36
One simple hack to hide that duplicate menu:
add_submenu_page(
'__FILE__', // parent slug, same as main menu slug
'', // empty page title
'', // empty menu title
'administrator', // same capability as parent
'__FILE__', // same menu slug as parent slug
'generate_retailer_list', // same function as parent
)
Upvotes: 1