Plugin sub-menu pages recommended structure and links
-
Sorry if this has been asked before; I have been looking for a while, but couldn’t find anything directly applicable. I am building my first plugin and I am trying to follow the WP best practices as detailed here.
My current plugin structure looks like this: – my-plugin — index.php — admin (folder — sub-menu-page.php
I am trying to keep all of my plugin pages separate as part of my organisation. However, I can’t seem to point my plugin’s submenu link to the sub-menu-page.php file. Here’s my menu code:
add_action('admin_menu', 'my_menu_pages'); function my_menu_pages(){ add_menu_page('WISE Admin', 'WISE Admin', 'manage_options', 'wise-menu', 'my_menu_output', 'dashicons-tickets', 2 ); add_submenu_page('wise-menu', 'General Settings', 'General', 'manage_options', 'general-settings', 'general_settings' ); add_submenu_page('wise-menu', 'Submenu Page', 'Submenu Page', 'manage_options', 'admin/sub-menu-page' ); remove_submenu_page('wise-menu', 'wise-menu'); }
The submenu link takes me to “mydomain.com/wp-admin/admin/sub-menu-page” which is obviously not where I want to go.
Can I please have some advice for what I am doing wrong?
- The topic ‘Plugin sub-menu pages recommended structure and links’ is closed to new replies.