Make WordPress Core


Ignore:
Timestamp:
05/15/2010 05:38:40 AM (15 years ago)
Author:
nacin
Message:

Make sure custom post types have unique IDs in the admin menu. props validBen, fixes #12445.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/menu.php

    r14614 r14654  
    117117    $ptype_obj = get_post_type_object( $ptype );
    118118    $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.
     119    $ptype_for_id = sanitize_html_class( $ptype );
    119120    if ( is_string( $ptype_obj->menu_icon ) ) {
    120121        $menu_icon   = esc_url( $ptype_obj->menu_icon );
    121         $ptype_class = sanitize_html_class( $ptype );
     122        $ptype_class = $ptype_for_id;
    122123    } else {
    123124        $menu_icon   = 'div';
     
    130131        $ptype_menu_position++;
    131132
    132     $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 );
     133    $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 );
    133134    $submenu["edit.php?post_type=$ptype"][5]  = array( $ptype_obj->labels->edit, $ptype_obj->cap->edit_posts,  "edit.php?post_type=$ptype");
    134135    $submenu["edit.php?post_type=$ptype"][10]  = array( $ptype_obj->labels->add_new, $ptype_obj->cap->edit_posts, "post-new.php?post_type=$ptype" );
Note: See TracChangeset for help on using the changeset viewer.