WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to have a submenu item in the admin section link directly to the edit form for a specific post ID, a custom post type at that.

Basically looking at using the add_submenu_page function to add the menu item http://codex.wordpress.org/Function_Reference/add_submenu_page which is easy.

Any ideas how to write a callback function to display the edit form for a specific post ID (which, in this case, happens to be a custom post type)?

share|improve this question

You do not need a callback function at all. You could display (yet another) custom edit screen, but if the custom post type is set up correctly you should be able to reach it simply by pointing to http://yourdomain.com/wp-admin/post.php?post=9999&action=edit where 9999 is any post ID that corresponds to a post of said type.

Hence you can use post.php?post=9999&action=edit as the menu slug (see the codex page of add_menu_page for reference on parameters) with add_submenu_page and you're good to go:

    'Edit My Special Post', // page title, change to liking
    'Edit SP', // menu title, change to liking
    'edit_posts', // required capability, change to liking
    'post.php?post=9999&action=edit' // menu slug, change post ID

The last parameter, the callback function, you don't need at all.

share|improve this answer
That worked, except when I select that submenu option, while I'm taken to the correct edit form, the parent menu is closed and the menu item is not highlighted. – Uysrc Aug 14 '12 at 15:20
@Uysrc & Johannes, this can be solved using jQuery and wrapping the page title above with a <span id="my-title" />, check this Answer. – brasofilo Jan 9 '13 at 1:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.