From 9af84531604bf7e5e447a7bd68e43ccebce76e46 Mon Sep 17 00:00:00 2001 From: nacin Date: Sat, 15 May 2010 05:38:40 +0000 Subject: [PATCH] Make sure custom post types have unique IDs in the admin menu. props validBen, fixes #12445. git-svn-id: http://svn.automattic.com/wordpress/trunk@14654 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/menu.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-admin/menu.php b/wp-admin/menu.php index b3428dc018..37e42505e6 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -116,9 +116,10 @@ $_wp_last_object_menu = 25; // The index of the last top-level menu in the objec foreach ( (array) get_post_types( array('show_ui' => true) ) as $ptype ) { $ptype_obj = get_post_type_object( $ptype ); $ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : $_wp_last_object_menu++; // If we're to use $_wp_last_object_menu, increment it first. + $ptype_for_id = sanitize_html_class( $ptype ); if ( is_string( $ptype_obj->menu_icon ) ) { $menu_icon = esc_url( $ptype_obj->menu_icon ); - $ptype_class = sanitize_html_class( $ptype ); + $ptype_class = $ptype_for_id; } else { $menu_icon = 'div'; $ptype_class = 'post'; @@ -129,7 +130,7 @@ foreach ( (array) get_post_types( array('show_ui' => true) ) as $ptype ) { while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) ) $ptype_menu_position++; - $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-' . $ptype_class, $menu_icon ); + $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon ); $submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->edit, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype"); $submenu["edit.php?post_type=$ptype"][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->edit_posts, "post-new.php?post_type=$ptype" );