Strange behaviour of add_submenu_page() / add_menu_page()
-
I am in the process of re-coding a simple plugin to use a classes, instead of a random collection of global functions and variables. I am also coding it to use the WP_List_Table class. I have encounterer a very strange problem. I am sure it is a simple typo in my code somewhere, but I cannot find it. I expect that a fresh set of eyes will spot the problem.
The plugin adds two main admin menu items, each with one sub-menu item. The first menu item is created fine, but its sub-menu item is created wrong. The second menu item and its sub-menu item are both created properly. I am using a class member function to display the admin pages (the function argument for both calls to add_menu_page and both calls to add_submenu_page is of the form array( $this, ‘member_function_name’ ), and for the both main menu items and the second sub-menu item, the URL generated is of the form /wp-admin/admin.php?page=slug, but for the first sub-menu the URL is /wp-admin/slug and I cannot figure out why it is doing that. I even tried creating a fresh wordpress site on my test server, and the same thing happens as on my proper test site on my test server.
I have what I have so far available at the URL
ftp://ftp.deepsoft.com/pub/deepwoods/Other/FMSchedule-1.0.zip
(Note: the plugin is not finished — only the first page (FM Show Sched) is ‘complete’ (but not fully debugged). The problem is with the ‘Add New’ sub-page for FM Show Sched. The FM Open Mics page and its sub-page are not written yet — there will be an error about require_once failing — this is because I haven’t written that code yet!
- The topic ‘Strange behaviour of add_submenu_page() / add_menu_page()’ is closed to new replies.