Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#12270 closed defect (bug) (fixed)

Incorrect menu active for edit custom taxonomy form

Reported by: jfarthing84's profile jfarthing84 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)

#1 @scribu
14 years ago

  • Milestone changed from Unassigned to 3.0

#2 @dd32
14 years ago

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.

Thats worked for me in core for quite awhile now. See #11838 which is related.

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.

Thats still a problem AFAIK, and needs to be updated as you suggest

#3 @jfarthing84
14 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 @jfarthing84
14 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.

#5 @dd32
14 years ago

Ah, Now thats clearer. Yes, When editing a term, Its defaulting to the post menu.

#6 @dd32
14 years ago

(In [13213]) Fix $post_type handling/passing in the Taxonomy edit links. Fix the Tag selection query var for edit.php in the Posts links. See #12270, See #11838

#7 @dd32
14 years ago

That commit should fix it. Re-open if you've still got any issues.

#8 @nacin
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.