WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom Post Type in Custom Menu (2 posts)

  1. Andrew Tegenkamp
    Member
    Posted 1 year ago #

    I added a custom top level menu with add_menu_page and it works great. I then added a custom post type and used 'show_in_menu' to add the custom post type to that custom menu and now that is taking over the default admin screen for my top level menu. Is there any around this behavior in WordPress? Before the CPT admin.php?page=custompage was the default for my custom menu but now it is edit.php?post_type=book which I only want as a submenu item.

    I have minimal code to recreate the problem using code from the codex at http://tegenkamp.com/wp-content/plugins/cptdev/cptdev.php.txt to help anyone wishing to recreate the issue on a development installation.

    Thanks,
    Andrew

  2. Andrew Tegenkamp
    Member
    Posted 1 year ago #

    Interestingly I just found that the add_action on admin_menu that contains the add_menu_page can be set to priority 9 (or likely lower since the default is 10) in order to have the original add_menu_page item show up and have a custom post type added with register_post_type show up as a submenu item (as I expected) and not take over the first menu item.

Topic Closed

This topic has been closed to new replies.

About this Topic