• I am trying to add an options page using https://developer.ww.wp.xz.cn/reference/functions/add_menu_page/ and then below that menu item I want to add a custom post type. The problem I’m running into is that when I add the custom post type and specify the parent menu item for it as my options page the link for the option page is replaced and goes to the custom post type page instead. Can anyone point me to how I can accomplish this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Joey

    (@leglesslizard)

    Hey,
    If you read through the codex for registering a post type you’ll see this:

    Note: When using ‘some string’ to show as a submenu of a menu page created by a plugin, this item will become the first submenu item, and replace the location of the top-level link. If this isn’t desired, the plugin that creates the menu page needs to set the add_action priority for admin_menu to 9 or lower.

    Setting the priority to 9 or less should solve your issue.

    Regards

    Thread Starter John Huebner

    (@hube2)

    Yep, thank you. I’ve read that page more times than I can count and didn’t recall that bit of information. Appreciate your time. Now I know what I’m looking at.

    Joey

    (@leglesslizard)

    Was a rushed answer, apologies if it came across as a “rtfm” response. That wasn’t intended at all 🙂

    Glad you got it sorted.

    Thread Starter John Huebner

    (@hube2)

    actually, didn’t take it that way. sometimes even when I do rtfm I tend to miss more the more times I read it. I was actually looking at add_menu_page and related documentation. I’m just glad that someone replied before I stumbled over it myself. Probably saved me several hours of banging my head on the keyboard 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Custom Post Type below Options Page’ is closed to new replies.