Plugin admin menu not removing duplicated entry as expected
-
Testing a plugin’s ability to create a custom post type with a top-level admin menu and several submenus, I’ve found a strange behavior when removing the expected “duplicate item”. WP 3.4.1…
So, the plugin creates a CPT which, in turn, creates the expected top-level admin menu item. I then added the submenus and they are showing/working as expected. The problem is in removing the duplicate entry — the remove_submenu_page function does remove the duplicate item, but in the process, the top-level item’s target is altered. The end result is that the top-level item leads directly to the ‘create new item’ page instead of the ‘list all items’ page.
I’ve read the docs several times on it and tried a quite a few variations without success; does anyone see a problem with this block?
function myplugin_register_plugin_settings_menu() { add_submenu_page( 'edit.php?post_type=mycpt', 'Settings', 'Settings', 'administrator', 'mycpt-settings', 'myplugin_mycpt_settings' ); remove_submenu_page( 'edit.php?post_type=mycpt', 'edit.php?post_type=mycpt' ); } add_action('admin_menu', 'myplugin_register_plugin_settings_menu');
Thanks for any insight.
- The topic ‘Plugin admin menu not removing duplicated entry as expected’ is closed to new replies.