Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to create a link under a custom post type I have named "portfolios". If I change "add_submenu_page" to "add_options_page" it correctly shows a new link under the "Settings" menu. But it won't seem to go in the portfolios menu, what am I doing wrong here?

    add_action('admin_menu', 'mt_add_pages');


    function mt_add_pages() {
    add_submenu_page(__('portfolios','menu-test'), __('Test Settings','menu-test'), 'manage_options', 'testsettings', 'mt_settings_page');


    function mt_settings_page() {
    echo "<h2>" . __( 'Test Settings', 'menu-test' ) . "</h2>"; 

    }

    }
share|improve this question
    
i think you are passing incorrent parent slug, i.e portfolios. check it again... inplace of portfolios pass the slug of your custom post type.. –  pr1nc3 Aug 23 '13 at 11:38
add comment

migrated from stackoverflow.com Aug 27 '12 at 12:56

This question came from our site for professional and enthusiast programmers.

2 Answers

add_options_page automatically adds it underneath settings, however add_submenu_page gives you control as to where you want it to show up.

Try something like this:

add_submenu_page('edit.php?post_type=portfolios', __('Test Settings','menu-test'), __('Test Settings','menu-test'), 'manage_options', 'testsettings', 'mt_settings_page');

Documentation: https://codex.wordpress.org/Function_Reference/add_submenu_page

share|improve this answer
    
Your code won't work unless, you're missing an third argument of menu_title. See the codex –  Rahil Wazir Nov 2 '13 at 11:37
add comment

It looks like you are looking for labels for custom post types. You can get an example on this website: http://teamtreehouse.com/blog/create-your-first-wordpress-custom-post-type

share|improve this answer
add comment

Your Answer

 
discard

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.