[wp-trac] [WordPress Trac] #13560: Add custom taxonomy to Pages admin menu

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 14 04:29:14 UTC 2010


#13560: Add custom taxonomy to Pages admin menu
--------------------------------------------------+-------------------------
 Reporter:  markauk                               |        Owner:          
     Type:  defect (bug)                          |       Status:  reopened
 Priority:  normal                                |    Milestone:  3.0     
Component:  Taxonomy                              |      Version:  3.0     
 Severity:  normal                                |   Resolution:          
 Keywords:  custom taxonomy, page, edit-tags.php  |  
--------------------------------------------------+-------------------------
Changes (by SeyelentEco):

  * keywords:  => custom taxonomy, page, edit-tags.php
  * status:  closed => reopened
  * resolution:  fixed =>


Comment:

 This fix, is missing the post_type=page parameter when building the edit-
 tags.php URL.  The result is that the edit-tags.php page by default thinks
 it's editing a Post, so it closes tha Pages menu and opens the Posts menu,
 and the links to view the Pages assigned to a Taxonomy don't work (since
 they default to Posts too).

 This line:
 {{{
 $submenu['edit.php?post_type=page'][$i++] = array( esc_attr(
 $tax->labels->name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' .
 $tax->name );
 }}}

 Should be changed to:
 {{{
 $submenu['edit.php?post_type=page'][$i++] = array( esc_attr(
 $tax->labels->name ), $tax->cap->manage_terms, 'edit-
 tags.php?post_type=page&taxonomy=' . $tax->name );
 }}}

 As a workaround, you can add a custom hook:
 {{{
 function modify_submenu() {
         global $submenu;
         foreach($submenu['edit.php?post_type=page'] as $key=>$smenu)
         {
                 $submenu['edit.php?post_type=page'][$key][2] =
 $smenu[2].'&post_type=page';
         }

 }
 add_action('admin_head', 'modify_submenu');
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13560#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list