I'm developing a very media-centered site with WordPress and am using the default categories and tags on uploaded media using, in part this plugin Media Categories.
I am displaying a sub-menu item under 'Media' for each 'Categories' and 'Tags' successfully using:
add_media_page( 'Tags', 'Tags', 'edit_posts' , 'edit-tags.php?taxonomy=post_tag');
It is linking through properly, but it seems somewhere in WordPress this page is assigned as a child of the default Posts type, as when I click it, it opens the 'Posts' menu and displays the Tags page, rather than keeping the 'Media' menu opened and displaying it from there. Is there any way to keep the parent page open (i.e. Media)?
This isn't an essential fix, but it would be good for the UI and continuity to have the Media menu stay open, rather than swapping to the Posts menu.
I can provide screenshots if this is confusing.
I've just discovered a cheeky little definition in edit-tags.php:
$parent_file = 'edit.php';
It seems each file corresponding to a submenu item in the WP Admin Menu has this $parent_file set. Now obviously, I can simply change this to 'upload.php' to refer to the Media parent, but I'm wondering if there's a non-hacky way that I can modify this value from functions.php in my theme file?