Try this:
add_menu_page(__('My Plugin', 'myplugin'),__('My Plugin', 'myplugin'), 'edit_posts','my-plugin-dashboard','my_plugin_dashboard','icon');
// dashboard submenu - this fails to highlight with current
add_submenu_page('my-plugin-dashboard', __('Dashboard','myplugin'), __('Dashboard','myplugin'), 'edit_posts', 'my-plugin-dashboard', 'my_plugin_dashboard' );
// settings submenu - this fails to highlight with current
add_submenu_page('my-plugin-dashboard', __('Settings','myplugin'), __('Settings','myplugin'), 'manage_options', 'my-plugin-settings', 'my_plugin_settings' );
Essentially: don’t use full page links with admin.php?… as the page slug. Especially if you are passing callbacks, just use a slug, not a page address.
Related Posts:
- Passing arguments to a admin menu page callback?
- What do you think about custom designed plugin/theme options UIs?
- Admin settings update updating every time home page is hit?
- What’s the best method for emptying an option created with the Settings API?
- What is the recommended way to create plugin administration forms?
- How to add a new plugin page under desired Options page?
- Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?
- Overwriting Core WordPress Functions with Plugins
- Plugin Architecture/Design Pattern – is better to use a private Observer/Mediator Pattern for plugin subclasses or WP add_action?
- Naming Admin Menus and Submenus
- Add Admin Menu Inside Construct or Init
- Hook event for upload image in the menu
- Menu Error in Admin Console with Custom Plugin: You do not have sufficient permissions to access this page
- add_menu_page() with function inside a class [duplicate]
- How to add Font Awesome 5 icons in WP Admin dashboard menu?
- How to put placeholder text in the main post input area?
- Unified Approach for Placing Option Pages
- Plugin with specific admin menu icon
- OOP Plugin and Menu – Call to undefined function register_setting()
- Creating a Link Text like Submit Button in Admin Page
- Applying OO patterns and principles to plugin development
- Global State During an Admin Post
- Howto: Use Custom Post Types as Submenu Items in Admin
- Sub Menu content is being duplicated
- Set different custom menu items for different user roles
- Show/Hide ‘add new user’ custom fields in wordpress admin panel by click another field
- Bootstrap doesn’t work on admin menu page-How to override wp-admin style?
- is it recommended to use WP_List_Table?
- Plugin sub-menu pages recommended structure and links
- Creating Admin Plugin – Content of a page is displayed at global scope as well
- Add a page in admin without adding menu item
- Silently register plugin pages
- WordPress theme options Menu
- Print Dashboard submenu name and filename
- I am trying to make a page in the admin section similar to the appearance of the Profile page for users
- Unable to get a simple plugin admin page to work
- Disable Auto-Expanding Menu in WordPress Admin Menus
- in_array function Problem
- Use options to control jQuery plugin
- Restrict certain actions to plugin-specific admin menu pages only
- Proper way to create an administration page without adding it to the menu
- Pause plugin option page until all data manipulation is complete
- How to add text editor in plugin menu?
- How to make an admin plugin menu page go full screen?
- Plugin frontend page design irrespective of the theme used
- How to add admin.php to WP Admin Menu Link
- Convert each new line in the textfield as a new value in an array
- How put the correct URL to sub-menu plugin?
- Developing a plugin where users can edit entries saved in database
- Add a description/hint field in the admin page of a plugin
- Forcing ALL plugin Admin menus into a separate menu
- Link to a admin submenu item using a custom link
- Plugin admin list pages as submenu
- Change Admin menu placement using hooks
- Menu_slug used for creating options page
- How to design WooCommerce-like admin tabs for plugin settings page?
- Show Admin Menu
- adding an options menu that allows saving multiple sets of said options
- Which action for triggering cron “wp”or “init”?
- What’s the difference between hooks, filters and actions? [duplicate]
- How can I hook into existing WordPress Bulk actions?
- creating elements/innerblocks via rangecontrol
- How to check if current static page is frontpage from admin plugin
- What method to use to call a REST API?
- Why my database table not created on activation?
- Resizing Images for a Gallery-Plugin?
- Which themes do you use to test compatibilities with your plugin [closed]
- How to debug a unit test for a WordPress plugin, which uses wordpress-test?
- Adding functions to hooks from within a class
- What filters to call to modify the output of the entire page?
- Tried in different ways but sidebar not working?
- How to Create a Simple Related Posts Plugin
- Help With Rewrite_Rules For a Custom Plug-In
- Theme Install using a Custom Repository
- How to add plugin version update option in plugin row action?
- error ‘The package could not be installed. No valid plugins were found.’
- How to Control CSS of Admin On Creating only a Specific Custom Post Type
- Run JavaScript validation script on form submit in plugin
- Google credentials and redirect URI for Google OAuth2 in a WordPress plugin, questions
- How to add plugin options in wp editor page
- How to format custom fields when editing an attachment?
- Woocommerce – Provide Associated Category Link for Product List Plugin [closed]
- How do I add an options page at the bottom of the list?
- How can I call wp-load.php in my plugin file
- How to create new content type and flushes rewrite rules without visiting the permalinks page?
- How to add quick edit on the list of users to edit custom fields?
- Unit Testing action hook
- Integrate separate web app inside wordpress [closed]
- PHP includes with AJAX actions
- Custom Post Type and Functions
- Issue on Getting Images URL of the Post Gallery
- I can install my plugin in localhost but not in my server
- WordPress.org how to force expire Cached Banner-772×250 from my Plugin page
- What is the Timeline for the Active Version Pie Chart in the Repository?
- Email verification feature in wordpress social login plugin
- Custom Pin it button is not showing over the image instead it shows as block top_left
- WooCommerce adds a newline symbol (\n) between email recipients
- Upload to a specific media folder created by FileBird Lite
- Page jumps to top
- Endpoint returning a 404