On the same page in codex you have this :
NOTE: If you’re running into the “You do not have sufficient permissions to access this page.” message in a wp_die() screen, then you’ve hooked too early.
So it answers to you question partly.
The second part, the following code should work :
add_action('admin_menu', 'my_add_submenu');
function my_add_submenu(){
add_menu_page( 'Parent', 'Parent', 'manage_options', 'author_discuss', 'author_parent' );
add_submenu_page( 'author_discuss', 'Author Discussion', 'Author Discussion', 'manage_options', 'author_discuss' );
add_submenu_page( 'author_discuss', 'Author Discussion Settings', 'Settings', 'manage_options', 'author_discuss_settings', 'author_discuss_settings_page' );
}
function author_parent() {
}
function author_discuss_settings_page() {
//do something
}
Check you functions and see if there’s some typo.
Related Posts:
- add_menu_page() with different name for first submenu item
- Difference Between Filter and Action Hooks?
- How do I create a custom role capability?
- How to create an API for my plugin?
- WordPress Update Plugin Hook/Action? Since 3.9
- what’s the meaning of the field wp_capabilities in table wp_usermeta
- Plugin – create a page without it appearing in the side menu
- Which action for triggering cron “wp”or “init”?
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- add_action with a class method is causing fatal errors
- How do you use the plugin boilerplate loader class to hook actions and filters?
- add_filter OO with parameters
- How do I print a notice only on certain admin pages?
- Do I need to call do_action in my plugin?
- How Do I Load My Action Earlier Enough?
- Which to use to execute code during the saving of a plugin settings page?
- Does WP fire delete_post when trashed posts are automatically deleted?
- How do I Make a Theme “plugin-ready”?
- Actions or filters fired when data is saved in a custom table
- In a plugin, why is add_action(‘init’) not executed before the plugin is activated?
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- What action is called when drafts are saved?
- How to add more than 1 user role to sub-menu pages
- How can I hook into existing WordPress Bulk actions?
- When is it too late to call the action wp_enqueue_scripts?
- How to allow Unfiltered HTML in a wordpress multisite install
- What is the Difference between directly call a function and call a function using add_action?
- How to add custom content under plugin row in WordPress admin plugin list?
- Define a function outside a class and call the function using action or filter hook
- Create a plugin to change the action to which a function is hooked
- How to avoid creating first submenu page that is same as menu page?
- Modifying values with add_action to be sent to db
- Woocommerce – Hide a Column in Cart Table
- admin_notices not displaying in plugin
- Hook to get image filename when it is uploaded
- How to run an add_action hook for specific page
- wp_transition_post_status does not change the status of the post
- Getting admin notices working for plugin errors
- Which are the hooks run before/after when a category’s deletion?
- Execute Hook on the footer or header after activating a plugin
- An echo line in a transition_post_status action leads to “cannot modify header information – headers already sent by”
- Namespaced action and filter tags
- Tried in different ways but sidebar not working?
- Sub Menu content is being duplicated
- conditionally load javascript & CSS for do_action() calls from plugin
- Plugin with action ‘save_post’ needs to press publish twice on order to publish
- Adding rewrite rule dynamically
- How to hook a custom user function to a wordpress core ajax action?
- Logout users upon login, based on caps/role?
- Unable to change footer using wp_footer action hook
- wp_set_object_terms not updating database without a die()
- Is there documentation reference for forms in menu and setting pages?
- How to filter content for specific content variable
- You do not have sufficient permissions to access this page on a submenu
- Show error message after exception handled
- I have 2 plugins using the same wp_login action hook and one is not working
- Create a custom capability to allow an ‘Editor’ to edit only ‘Subscriber’ users
- Valid filenames for add_action’s first parameter
- WordPress class, using add_action to call member function does not work
- Where do I put my add_action(… and add_filter(… and do I need to remove them?
- How dynamic action login_form_{action} is working
- What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
- How to get all queries’s results after they have executed?
- When does save_post hook fire on post save/update
- A question about add_action()
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- Hook add_attachment error
- Call to undefined function is_home() or any conditional tags
- How to use gettext for specific user role
- How to find list of all functions bind to a particular hook from my plugin?
- Can I Hook Into the TinyMCE Insert/Edit Link Button to Use Shortlink For Post?
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- wordpress automatic update does not run
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- How Can I Add Code To A Preexisting Function Without Editing it
- Setting post_id for single.php based on URL without a redirect
- How to do admin ajax request in a plugin for rest api
- Action / Hook when a new plugin is added
- apply_filters() and call_user_func() to define and call a function outside a class
- How to create a custom post-new.php page for plugin , no wp menu
- Allow contributor user role to perform copy operation PHP
- ajax-action.php can’t find added action
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- do_action from within a class does not seem to work
- Buddy Press restrict the capability to edit users
- wp_ajax add_action fuction won’t fire on custom jQuery action
- add_option_{$option} action hook not being called
- Does WordPress have something like timer hook?
- What is more secure checking capabilities of user or checking role of user in WordPress plugin development
- action callback, for action dispatched as reported by hook sniffer, not called
- Add Admin menus or submenus depending on conditions
- How can I set a dynamic value for post_updated_messages based on return value of post_updated?
- Plugin capabilities
- Adding querystring variable breaks admin URLs
- Sending Parameter Failed
- How to remove a class [closed]
- Insert plugin html content to a specific spot in the frontpage
- Ninja Forms: Front-End Forms, Post ID?
- Custom database table entry edit page