WordPress Admin Page without a link on the sidebar.

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:

add_posts_page(‘Manage Your Linked Posts’, ‘Link Posts’, ‘administrator’, ‘lmp’, ‘lmp_admin’, get_bloginfo(‘siteurl’)."/wp-content/plugins/LinkMyPosts/images/lmp-icon2.png");



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…

add_submenu_page(‘linkPosts’, ‘Edit Link Title’, ”, ‘administrator’, ‘lmp_editLink’, ‘lmp_editLink’);



For more information about adding administration and submenus, visit WordPress.

Facebook Twitter Linkedin

Related posts:

  1. Tag Grouping Plug-in Documentation
  2. Add JavaScript to your WordPress plugin.
  3. WordPress Plugin – Grouping Your Tags (PHP5 and MySQL)
  4. Tag Grouping V1.2 & v1.3!
  5. Adding AJAX to your WordPress plug-in

About Mike

I am a Software Quality Assurance Professional that recently graduated college with a Bachelor's of Science in Computer Information Systems.
This entry was posted to the following categories: Code Sample, PHP, Wordpress. Bookmark the permalink.

2 Responses to WordPress Admin Page without a link on the sidebar.

  1. conan says:

    damn, so stupid simple:). Thanks very much.

  2. What Conan said. Thanks for the info, and thanks for putting it in quick, easy to digest form.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>