WordPress.org

Ready to get started?Download WordPress

Forums

Plugin Menus and submenus (2 posts)

  1. dyrk
    Member
    Posted 3 years ago #

    Hi

    I'm writing a plugin that requires a few subpages.
    I have my initial defined like this:

    add_action('admin_menu', 'acme_menu');
    
    function acme_menu() {
    	add_menu_page('Acme', 'Acme', 'manage_options', 'acme', 'acme_events');
    }

    This works fine and I display the content with acme_events.

    Now I'm trying to create a sub-menu like this

    function acme_sub_menu() {
    	add_submenu_page('acme', 'Import Acme Event', 'Import Acme Event', 'manage_options', 'import-event', 'import_event');
    }

    The menu appears, but the slug is wrong - it shows 'wp-admin/import-event' instead of '?page=import-event' - clicking it gives me a frontend 404.

    What am I doing wrong?

    I hope someone can help me as I have not had much luck with these forums. I've posted numerous equally urgent questions that remain
    unanswered.
    Are there any OTHER wordpress forums?

  2. dyrk
    Member
    Posted 3 years ago #

    Fixed it.
    Was importing the sub page and ultimately calling the sub menu BEFORE the main menu. Still showed, but now the link works...who knows...ah well...RESOLVED.

Topic Closed

This topic has been closed to new replies.

About this Topic