Recently I wanted to create some pages that I could link to from within the administration page of a new plug-in I am creating…without them showing up on the sidebar pane. You see, I have a new item I want to place in the Posts Admin section that requires multiple pages. It would look real ugly if all of the pages were listed in the sidebar. I could create my own area and list all of the pages underneath the area heading but that seemed like a little much. This plug-in fits in the Posts section and really not in it’s own area.
I had some difficulty figuring out how to create pages that did not show up in the sidebar. The answer was so simple that I was somewhat disappointed it took me so long to come to it. In case any of you are struggling to do the same maybe this will help.
I started off by creating a sub page under Posts with the code below:
Position 1 is the title of the page that will spawn if a user clicks on the link.
Position 2 is the title of the menu option displayed to the user in the sidebar.
Position 3 is the capability required to exercise this option.
Position 4 is the menu_slug which is what you reference it by programmaticay.
Position 5 is the function that is called when the link is pressed.
This page would spawn with a button to “Add” links which would take the user through a wizard-like experience. In order to add a page that was not listed in the sidebar, you simply add a submenu page with a parent_slug that does not exist. This will create a page you can use that will not show up in the sidebar. See below…
For more information about adding administration and submenus, visit WordPress.
Related posts:
damn, so stupid simple:). Thanks very much.
What Conan said. Thanks for the info, and thanks for putting it in quick, easy to digest form.