I have added to my-plugin submenu a custom view of the user list using users.php
and a my_plugin_view
argument to filter the request:
add_submenu_page(
"my-plugin",
'Subscribers',
'Subscribers',
'edit_users',
'users.php?my_plugin_view=subscribers'
);
When /users.php?my_plugin_view=subscribers
is open the admin sidebar toggle Users > All Users instead of My Plugin > Subscribers
I have tried:
if( isset($_GET['my_plugin_view']) ){
remove_submenu_page( 'users.php' );
}
but this removes the All Users section from the sidebar and doesn't toggle the plugin menu as expected.
How to keep the plugin submenu open on viewing a custom version of users.php ?