Opened 15 years ago
Closed 15 years ago
#12270 closed defect (bug) (fixed)
Incorrect menu active for edit custom taxonomy form
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Administration | Keywords: | needs-patch |
Focuses: | Cc: |
Description
When using edit-tag-form.php for a custom taxonomy, the correct menu is not highlighted. This is because the variables $parent_file and $submenu_file are not set or not correctly set. The "Edit" links within the tag row actions will need to be updated to include "post_type" as it is needed to point to the correct parent_file and submenu_file for the custom taxonomy menu.
Change History (8)
#3
@
15 years ago
I'm not sure you understood. Let's say I have a custom post type "movie". Within that product I have a few taxonomies: "actor", "director", "writer", etc.
Now, when I visit "edit-tags.php?taxonomy=actor&post_type=movie" (which is the default menu created by WP), the correct menu item is highlighted ("Movies") along with the correct sub-menu ("Actors"). However, click the edit link for a specific term (i.e. "edit-tags.php?action=edit&taxonomy=actor" and then the "Posts" menu is highlighted with no submenu highlighted.
This is due to no post_type being passed with the edit link, because the post_type is included in the key for the submenu. Same with the menu.
#4
@
15 years ago
if ( empty($post_type) || !in_array( $post_type, get_post_types( array('show_ui' => true) ) ) ) $post_type = 'post'; if ( 'post' != $post_type ) { $parent_file = "edit.php?post_type=$post_type"; $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; } else { $parent_file = 'edit.php'; $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; }
Because of that, when editing a term, the post_type is always post because the post_type is not passed via the query. So, $parent_file will always evaluate to 'edit.php' and $submenu_file to 'edit-tags.php?taxonomy=$taxonomy', thus highlighting the incorrect menus.
Thats worked for me in core for quite awhile now. See #11838 which is related.
Thats still a problem AFAIK, and needs to be updated as you suggest