I have checked your code. You are using incorrect menu-slug
in add_submenu_page. Because admin already has page query var which conflicts with your menu slug page=settings&submenu=page2
.
I have updated the code.
add_menu_page( 'Main Menu', 'Main Menu Titlw', $min_access_cap, 'main-main', array($this, 'main_menu'), $icon_url, 999 );
add_submenu_page( 'main-menu', sprintf( __( '%1$s ‹ %2$s', 'main-menu' ), $title['page_title'], 'Submenu' ), $title['admin_menu_title'], $min_access_cap, 'submenu/slug', array($this, 'sub_menu') );
Related Posts:
- How to Add a Third Level Sub Menu to the WordPress Admin Menu
- Admin menu as submenu from another plugin
- Creating a WordPress admin page without a menu for a plugin
- Removing an admin page added by a 3rd party plugin. Gravity forms in this example
- Delete option doesn’t appear for plugins
- Adding an admin page – OOP approach not working
- Generate Advanced Custom Fields box in custom admin menu page
- Plugin development: how to create a form and get custom data?
- Master menu item for multiple plugins?
- How to make a WP admin button/menu similar to Jetpack Notifications?
- wp_verify_nonce() why return false?
- Detecting when a custom taxonomy has been changed and display alert?
- Removing WordPress Plugin Menu Item for a specific user
- add function to saving change on Options Pages
- Change the $parent_file of a plugin page
- reorder plugin menu position
- How do I remove the entire left nav bar in admin for certain level users?
- Hide Theme options and Customize Admin menu
- How to send little data between admin pages of my plugin?
- how can I link to a PlugIn admin-sub-menu page after processing a formular
- White page on custom plugin option submit
- Make menu page link inaccessible or disabled
- Show existing POST categories as items in the sidebar menu [closed]
- Polylang : Interverting languages after development [closed]
- Suggestions on Approach to New Plugin I’m Stuck On
- Dynamic admin submenu
- WP Plugins – Use includes to display page content
- Add menu page issues (permissions & position)
- How to use add_submenu_page() for editors?
- What’s causing this error? “Warning: Invalid argument”
- Move plugin-settings to ‘Settings’-menu in the admin
- Editing a text file from plugin menu
- WordPress Admin Menu defining function is seperate file
- creating a plug in that would tap into save/update action of posts [closed]
- Display Plugin Panels Outside of Admin Areas
- Why WP_Screeen doesn’t show all options with admin_body_class
- Plugin Admin Menu Boiler Plate
- add_submenu_page returns null
- Plugin – Admin menu page broken url
- How do I add an options page at the bottom of the list?
- How to remove a CPT Menu from the Root Admin only
- Show WordPress Plugin Menu(Admin) To Editor
- Add logo to admin menu in my plugin
- How do you add a settings page to another menu?
- Custom page in plugin visible in menu
- Adding custom Field To The Posts Listing
- Creating an admin button that when clicked shows a popup form
- add menu page not showing Icon
- Custom Icon assigned to menu items not working for multi-site networks
- Admin menu hilighting wrong item for CPT
- Creating Admin Submenu Page via Class Method
- Plugin option for input box validation
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- Assigning a custom post type to a custom page
- How can I pass value to function in add_menu_page?
- Getting 404 page not found error while trying to access add new plugin / themes
- Plugin menu replaced by another plugin?
- Plugin link does not appear in my toolbar
- admin_enqueue_scripts using hook_suffix vs GET page
- Submitting form to admin-post.php WordPress
- Should all plugins be encapsulated in a Class?
- How can I bulk edit variations in woocommerce? [closed]
- Search and replace text across all posts
- Dashboard Widget Form
- How to achieve certain page (url) accessible to certain users
- Plugin upload to install
- WordPress repository forbids me call wp-load.php in non-WordPress file
- Redirection based on location but without affecting search bots
- Bulk edit WP posts to update embeded images with new alt tags
- How to put Word documents online so they can be downloaded, printed and read via a web page? [closed]
- How can I show a different theme for admin users? WP 3.8+
- Add User Role: Pre-saved in User-Meta [SOLVED]
- Flickering sidebar when scrolling page [closed]
- Shortcode not working – quotes seems strange
- Storing The Data Collected by Ninja Forms into Another (custom) Database [closed]
- Add action to custom Function
- Shortcode not displaying HTML within the function
- Enqueue css to a third-party plugin template
- Preset custom fields
- website shows blank when visiting from mobile
- Hide WordPress Site URL from Source Code
- Upload files with Q&A admin
- Plugin function in child theme
- How to access Post Archive created by Elementor?
- CRUD from WordPress to Business Central 365 through OData REST API
- Create multiple domains to download my custom plugin from wordpress.org
- Move plugin upload folder from mywebsite.com/wp-content/uploads/pdfuploads to mywebsite.com/pdfs?
- Deactivate sub-plugin when parent-plugin is deactivated
- WordPress showing fatal error on wp_set_object_terms line
- How do I keep children of certain parent menus expanded by default on a sidebar?
- How do I add a textarea (multirow) option to my WordPress plugin?
- WordPress CPT Url metabox collection
- Changing the body of mail sent to new user registration
- WordPress hook source
- Locale changed but plugin still showing default language
- Fatal error with Ultimate Coupon plugin
- is there a way I can add or remove some plugin options?
- How to add homepage Widget?
- wp_handle_upload – specified file failed upload test
- Split Million WordPress Post’s Into Multiple Database Server