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've created a custom posts top level menu item but I would like to have a submenu under that linking to the Add Gallery page of Nextgen, as the client wants all their functionality bundled up under one top level menu item.

So far I'm doing :

add_submenu_page( 
    'edit.php?post_type=events', 
    'Add Gallery', 
    'Add Gallery', 
    'administrator', 
    'nggallery-add-gallery', 
    'event_add_gallery'
);

But the link looks like:

http://example.com/wp-admin/edit.php?post_type=events&page=nggallery-add-gallery

Is there any way to achieve this?

share|improve this question

1 Answer 1

It would go like this (note the absence of the function parameter - and also the capability instead of a role).

add_action( 'admin_menu', 'wpse_74421_menu_admin' );

function wpse_74421_menu_admin() 
{
    add_submenu_page( 
        'edit.php?post_type=events', 
        'Add Gallery', 
        'Add Gallery', 
        'delete_plugins', 
        'admin.php?page=nggallery-add-gallery'
    );
}
share|improve this answer

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.