Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a built a plugin which creates a custom menu like this:

    add_menu_page( 'Wholesale Pricing', 'Wholesale', 'manage_options', 'woo-wholesale', 'woo_wholesale_page_call'); 

I am now trying to add a subpage item underneath this. I have read the codex and came up with:

add_submenu_page( 'woo-wholesale', 'Registrations', 'Registrations', 'manage_options', 'woo-wholesale-registrations', 'wwpr_page_call' ); 

I am guessing this is incorrect as the submenu item isnt showing. Can anyone shed any light on this please?

share|improve this question

1 Answer 1

Make sure that your add_action hook is set to admin_menu.

Here's a sample code:

add_action('admin_menu', 'wpse149688');
function wpse149688(){
    add_menu_page( 'Wholesale Pricing', 'Wholesale', 'manage_options', 'woo-wholesale', 'woo_wholesale_page_call');
    add_submenu_page( 'woo-wholesale', 'Registrations', 'Registrations', 'manage_options', 'woo-wholesale-registrations', 'wwpr_page_call' ); 
}

Also check whether user you've logged in as has the ability to view this menu. As this menu is set using manage_options capability.

share|improve this answer
    
Hi, yes my add_action is set to this, thanks anyway! –  dan Jun 15 at 17:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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