I have a custom post type called newsletter. Once the newsletter is created I want to create a link to download the newsletter from the admin section (the newsletter post type is not accessible from the front end of the wordpress site). When the download link is clicked it will run a function in my plugin. The question is how do I register a url with wordpress that will do such a thing? I'm sure this is something pretty simple and I'm just missing it.

  • Are you specifically wanting permalinks and pretty URLs? If so you could have a huge uphill battle depending on the form you want to take. Or do you mean how would you implement the button and how to place it in the backend? If you could clarify further with examples diagrams etc it would help greatly
    – Tom J Nowell
    Commented Jan 16, 2013 at 17:00

1 Answer 1


You want (probably) add_submenu_page. The first parameter-- the one listed as $parent_slug in the Codex is going to be edit.php?post_type=your-post-type-name, like this (mostly cribbed from the Codex page):

function add_submenu_wpse_81844() {
    , 'My Custom Submenu Page' 
    , 'My Custom Submenu Page'
    , 'manage_options'
    , 'my-custom-submenu-page'
    , 'my_custom_submenu_page_callback'
add_action('admin_menu', 'add_submenu_wpse_81844');

Check the Codex for what the other parameters mean.

  • thanks that's what I needed. Do you know if there is a way to create a submenu without it showing in the sidebar? Basically this link will only be used to download the newsletter which is accessed through a button when the posts are listed. Commented Jan 17, 2013 at 17:15
  • I believe you can pass null as the first parameter. See the Codex page.
    – s_ha_dum
    Commented Jan 17, 2013 at 17:24
  • yes you can do null. In my case I set it to options.php which achieves the same results. thanks. Commented Jan 17, 2013 at 17:45
  • one other small issue. Is there a way to prevent the admin theme from being output? Since I'm streaming a zip file to the client, I don't want the admin wrapper. I didn't see anything on the codex page about it. Commented Jan 17, 2013 at 17:51
  • For anyone interested the above question about the admin wrapper ended up getting answered here: wordpress.stackexchange.com/questions/82041/… Commented Jan 18, 2013 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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