Try adding the action after the function like this:
function mt_add_pages() {
// Add theme options page to the addmin menu
add_menu_page(__('Competition','comp'), __('Competition','comp'), 'manage_options', 'mt-top-level-handle', 'test_func', '', 5 );
add_submenu_page('mt-top-level-handle', __('Answers','comp-answers'), __('Answers','comp-answers'), 'manage_options', 'sub-page', 'test_func2');
}
add_action( 'admin_menu', 'mt_add_pages' );
Related Posts:
- Settings page above CPT page in admin section
- Adding a Custom Post Type into the menu screen
- Highlighting wp_nav_menu() Ancestor Class w/o Children in Nav Structure?
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- Adding a menu item for a Custom Post Archive
- Adding an Archive of Posts to the Navigation Menu in WordPress 3.0
- Adding custom post type archives to a WordPress menu
- How to add custom post type archive page links to nav menu?
- Show Custom Taxonomy Inside Custom Menu
- Remove current_page_parent nav class from blog index when in CPT
- Creating “static” taxonomies to choose from, inside custom post type?
- Query menu_order custom post types
- Now can I group custom post types together?
- How to add meta box to backend menu page
- Custom Post Type Menus
- How can I get my Custom Post Types to appear in nav-menus.php ‘Menu’?
- Highlighting current item of custom post types’ sub pages, listed by wp_list_pages
- Extend walker class with custom post types [closed]
- Hide custom post type from nav menu manager
- wp_list_pages not showing cpt as I expected
- automatically placing custom post types singles into submenu of main nav menu
- Renaming Menu Item within Admin Menu Section for a Custom Post Type?
- How to Programically add to the new WordPress menus
- Menu with Automatic Pages Included from Custom Post Type
- Which User Role for Custom Post Type Menu – wp_nav
- Create Custom Post Type Archive Page with Sub Categories Navigation Sidebar
- Editor access to menu: custom post type missing
- Custom Post Type .current-menu-item not applying on Custom Post Type Archive Page
- Remove current_page_parent from posts page link in WordPress nav menu
- Highlight parent menu item when child post
- wordpress custom post type remove duplicate menu item
- Adding Custom Taxonomy Archive Link to Nav Menu Shows Up As (Invalid)
- Why are navigation items saved in the database?
- Menu highlight custom post type archive
- adding .current* tags to custom post types and taxonomies
- How to get custom post type menu_name?
- How do I create an archive page for standard posts?
- ‘Pages’ widget alternative for custom post types?
- Add the current menu item CSS class to a custom page type archive in WordPress menu
- wp_nav_menu() mark current item ancestor of custom post type
- current-menu-item class for custom post type parent
- How to change the admin menu “Pages” to something else
- Menu Multiple Taxonomies
- how to get post slug from url in wordpress
- Navigation menus not showing because of custom post type filter
- Fake mark a menu item as current_page_item/active in WordPress
- Add/Remove current_page_parent class
- Should I use custom menu, C.P.T. or theme options, or something else for this?
- Set menu active state for custom posttype and category, given custom taxonomy term
- Update menu when saving settings
- Function to display custom post type on front page makes menu items dissapear
- custom post type not showing in menu
- Insert & order custom post types in/as submenu
- Correct classes for WordPress menu items
- Custom Taxonomy Navigation, with current menu items for children?
- Customize the Dashboard Menu Editor
- Display posts from Custom Post Type in category page on front-end
- Use menus with anchors
- How to make this menu drop down or like accordion
- Custom Post Type Nav to Subpage
- Custom Post Types don’t highlight in menu nav
- Querying both pages and posts
- Using default WP menu functionality to link to custom post-type listing?
- Second Set of Eyes: One custom taxonomy shows in Appearance > Menus, one does not
- Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?
- page menu entry for custom post type
- How to display custom WP menus?
- Is there a way to establish parent/child relationship in WP menu links exclusively?
- Use custom walker to add taxonomy terms to main nav menu
- A page that shows a list of a specific custom post type
- Single custom post type’s menu ancestor/parent is Posts archive page
- menu link to custom post_type?
- Review site custom post type structure
- Custom Post Types in the WordPress Navigation Menu
- Custom Post Type & Custom Menu Walker to append custom class for active post types
- Ordering Submenu Pages in WP 3.1
- Including link to custom post type in ‘wp_list_pages’ function
- Which Template Page Should I Use?
- How can i automatically add CPT single pages as sub menu items
- How can I use archive-{post_type}.php theme template?
- Custom Post Type Link added to menu won’t show in frontend
- How To Display A List Of CPT Posts In A Meta Box On Menus Page?
- Get custom post type categories to show up in menus
- How can I create an automatic drop down menu with my tags?
- show current item in custom menu, when inside a custom post type
- WordPress menu with custom taxonomy
- Prevent custom post type from showing up in custom menus
- Show category and tag link as a submenu under custom post type submenu
- Custom Post Type – Portfolio no longer works
- How to programmatically add elements in a custom menu
- Custom Posttype and menu classes
- highlight parent page menu item when in custom post type
- Custom post type post in custom menu
- Custom post type posts wont show in wp_nav_menu()
- Home page is getting current-menu-item even if it’s not home
- Placing Admin Post Metaboxes in Tabs
- Menu for taxonomies and posts belongs to taxonomy
- How can I put content before my custom post type default pages?
- How we can create menu from Appearance > Menu and use as a add-submenu-page for admin menu?
- build child and anchestor three from post parent