WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding edit-tags.php?taxonomy to a subpage (2 posts)

  1. davidsword
    Member
    Posted 3 years ago #

    I've reworked my media library to run on categories. so I have a taxonmony media_category for Media items. I used the edit/manage taxonomy page that wordpress's Posts & Links use, & just changed the taxonomy query in the url, so my add_submenu_page('upload.php'....) function argument looks like:

    edit-tags.php?taxonomy=media_category

    it does work, but when on the edit tax page, the "Active" window in the admin navigation, is highlighting Posts instead of Media ... as if it has no idea that the URL belongs to "MEDIA".. see screen cap:

    http://cl.ly/7j3B (green highlights that we're on the highlighted subpage, and the proper content is showing. red highlighing that for some reason, when in the sub-menu "Media Categories", the "Posts" top level page is highlighted and expanded instead of the "Media" top level page)

    I've been stuck on this for 4 hours.. any info would be greatly greatly appreciated..

  2. davidsword
    Member
    Posted 3 years ago #

    Solved. After another wasted day of trouble shooting. Looks like the issue was my PARENT file wasn't defined, and reverted to default "edit.php" which opened "Posts"

    The solution is to use the "parent_file" filter. in my functions.php:

    if (isset($_GET['taxonomy']) && $_GET['taxonomy'] == 'media_category') {
    	add_filter('parent_file', 'change_parent_to',999);
    }
    
    function change_parent_to() { return 'my_parent_page' }

Topic Closed

This topic has been closed to new replies.

About this Topic