• Resolved guar

    (@guar)


    I’m creating an events custom post type and want to add an extra submenu item in the admin panel for the Events type (a Settings page).

    i.e.
    Events

    • Events
    • Add New
    • Settings

    Actually, I have already created the menu item, but for the life of me I can’t get it to do anything other than redirect to the admin homepage of the main site.

    I should point out that I’ve got WP in multisite mode, and I’m trying to get this to work on a sub-site.

    So using add_submenu_page I have this line:
    add_submenu_page('edit.php?post_type=event', 'settings', 'Settings', 'manage_options', 'event_settings', array(&$this,'show_menu'));

    Which is similar to the code found at http://codex.wordpress.org/Adding_Administration_Menus

    As I say, it puts the menu item in the right place and this is the URL it links to: http://localhost/wp3/subsite/wp-admin/edit.php?post_type=event&page=event_settings

    But when I click on the link it takes me to:
    http://localhost/wp3/wp-admin/?c=1

    i.e. the main site admin page.

    I feel like I’m missing something obvious, but I’ve been around in so many circles now, I need a little help.

    cheers

Viewing 1 replies (of 1 total)
  • Thread Starter guar

    (@guar)

    I feel like a complete dork – or perhaps the double espresso helped. The problem wasn’t with my add_submenu_page command, but with the add_action:

    i.e. I had:

    add_action("admin_init",array(&$this,'admin_menu'));

    instead of :

    add_action("admin_menu",array(&$this,'admin_menu'));

    Makes all the difference you know.

Viewing 1 replies (of 1 total)
  • The topic ‘submenu item for Custom Post Type’ is closed to new replies.