I didn’t test this but i’m pretty sure you just need to remove your code from the admin_menu() function declaration.
Like this:
add_action('admin_menu', 'register_my_custom_submenu_page');
function register_my_custom_submenu_page() {
add_submenu_page(
'tools.php',
'Submenu Page',
'My Custom Submenu Page',
'manage_options',
'my-custom-submenu-page',
'my_custom_submenu_page_content' );
}
function my_custom_submenu_page_content() {
?>
<div class="wrap">
<h2>Page Title</h2>
</div>
<?php
}
Related Posts:
- Check if add_menu_page exists or not
- Creating WordPress Plugin solely for Admin panel with dash menu and submenus
- Creating a nav menu
- Howto check version of another plugin and then add a submenu page to it
- How to use add_submenu_page() for editors?
- Use current class method inside add_submenu_page()
- Why WP_Screeen doesn’t show all options with admin_body_class
- $pages = get_pages(‘child_of=’.$post->ID); Why arguments are concatenated?
- Adding submenu to custom plugin menu page created with add_menu_page() function
- WordPress Custom Menu Admin helper plugin
- How do you add a settings page to another menu?
- Settings options not showing up on Sub Menu page in WordPress plugin
- How to Call Specific .PHP file on add_submenu_page selection in Plugin Development?
- How to hide plugin submenu title in drop down in admin panel in wordpress?
- How to add styles to a submenu page?
- Admin menu hilighting wrong item for CPT
- Horizontlal scrolling content
- Add subemenu option page
- Redirect loop when forwarding to mobile site
- Ajax Not Working If The Handler is Located Outside Plugin Submenu Page Function
- Multiple plugins settings of same developer into ONE settings page linked together
- WordPress Custom Pages that work with Plugins?
- posts from multiple post types in one slider
- How to automatically redirect to custom admin menu after plugin activation?
- How to use the CSS of the WordPress core in the development of my administration page?
- Redeclare function after plugin activation
- add_submenu_page returns null
- What is the WordPress approach to custom data?
- Conditional Shipping Options if Certain Products are in Cart WooCommerce
- Readable titles in mobile
- How to do the simplest possible frontend ajax call from a plugin?
- The XXX plugin has been deactivated due to an error: The plugin does not have a valid header
- How can I add “last updated” in plugin descripton?
- get_edit_post_link() not working on wp-cron
- get_option / wp_localize_script Not Working in OOP Plug In
- New bulk action to resend welcome emails
- Get site url and updates data, then use them
- How to have a gallery in which each image’s caption is a whole “post”?
- I receive taxonomy id
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- WordPress won’t allow for updates to plugins or WordPress Core
- WordPress Stock Update Programatically
- Loading a plugin’s js file from functions.php
- Woocommerce Backend Search by Title and SKU
- I Setup Rate My Post Plugin On Site But Now Got Issues In Google Webmasters
- How to integrate together a website currently hosted WordPress.com and a custom web application currently hosted on Azure?
- How-to: This block can only be used once
- output html on post or page from custom plugin [closed]
- Custom Post Type – custom form in dashboard
- Problem with add_action
- To perform the requested action, WordPress needs to access your web > server
- Custom API plugin to execute 3rd party API to retrieve data
- Is there a way to convert shortcodes to html content?
- Proper way to handle admin-ajax calls
- How to display the featured post on the category page?
- Disable globally “Crop thumbnail to exact dimensions (normally thumbnails are proportional)” with Multisite
- How to find the list of custom post type where logged in user is author
- UTF-32be error WordPress
- Loop in elementor custom widget not working
- Change text string in a plugin
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- wp-admin send 404 error
- How to create plugin/ page that reads from database
- Stop wordpress from requesting external jquery from googleapi
- Can the benefits of performance optimization plugins outweigh the tax of installing them on performance?
- get_users(); Is an Undefined Function When Used in Cron Job
- Alternate email sending service – eg: AWS SES [closed]
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- Disabling a plugin lead to styles being shown as plain text
- the_content() printing DOCTYPE, and tags in the middle of page
- How to deal with Slow HTTP POST (slowloris) vulnerability
- How to create author profile showcase in wordpress
- What is the purpose of WP_CONTENT_URL?
- Blog previews on custom page with more buttons
- Order posts by meta key ( Using ACF )
- Control page content visibility based on URL parameter
- Where does MonsterInsights put Google Analytics code?
- WooCommerce Shopping Cart Not Initially Showing Products [closed]
- Elementor Custom Control: How to get input value?
- Elementor page builder plugin not loading up all the way? [closed]
- How to add fields in the WordPress editor?
- How can I fetch data from another website to my wordpress website with mysql database
- Sucuri SiteCheck failing on domain with iThemes Security Pro plugin
- How to translate WP Blog (search, category etc.)?
- WordPress SVN UTF-8 issue
- How can I concatenate variables to search results title? [closed]
- Migrating WordPress – New domain entry, links broken
- Search Results Page filter by page title
- Activate and deactivate plugin automatically
- WooCommerce: after install hook
- Test my WordPress Plugin standard or not
- Theme My Login Shortcode Doesn’t Return Anything
- How retreive saved data from gravity forms in my template?
- is_rtl returns false while it should return true
- issue in wp_localize_script
- Import MS-Access data file to make the searchable page
- License validate function
- Sanitize $_GET variable when comparing
- Include Minit plugin in theme [closed]
- Plugin for an interactive image? [closed]