From 1849b362b020305f9bd476de6b32fcec43885f43 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 8 Jun 2010 15:34:42 +0000 Subject: [PATCH] Make set_current_screen() taxonomy aware. Use current_screen when setting up table headers for edit-tags.php. see #13783 git-svn-id: http://svn.automattic.com/wordpress/trunk@15175 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin.php | 7 ++++++- wp-admin/edit-tags.php | 5 ++--- wp-admin/includes/template.php | 13 +++++++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 1932caf88..a759d452b 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -81,10 +81,15 @@ if ( isset($_GET['page']) ) { } if ( isset($_GET['post_type']) ) - $typenow = sanitize_user($_GET['post_type'], true); + $typenow = sanitize_key($_GET['post_type']); else $typenow = ''; +if ( isset($_GET['taxonomy']) ) + $taxnow = sanitize_key($_GET['taxonomy']); +else + $taxnow = ''; + require(ABSPATH . 'wp-admin/menu.php'); if ( current_user_can( 'manage_options' ) ) diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 898afc34c..a4b48bc80 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -296,17 +296,16 @@ if ( $page_links )
- - + - + diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index dc8fc15f4..221249330 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -396,7 +396,7 @@ function wp_link_category_checklist( $link_id = 0 ) { * @return unknown */ function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) { - global $post_type; + global $post_type, $current_screen; static $row_class = ''; $row_class = ($row_class == '' ? ' class="alternate"' : ''); @@ -422,8 +422,8 @@ function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) { $out .= ''; - $columns = get_column_headers('edit-tags'); - $hidden = get_hidden_columns('edit-tags'); + $columns = get_column_headers($current_screen); + $hidden = get_hidden_columns($current_screen); $default_term = get_option('default_' . $taxonomy); foreach ( $columns as $column_name => $column_display_name ) { $class = "class=\"$column_name column-$column_name\""; @@ -3900,7 +3900,7 @@ function compression_test() { * @param string $id Screen id, optional. */ function set_current_screen( $id = '' ) { - global $current_screen, $hook_suffix, $typenow; + global $current_screen, $hook_suffix, $typenow, $taxnow; if ( empty($id) ) { $current_screen = $hook_suffix; @@ -3932,6 +3932,11 @@ function set_current_screen( $id = '' ) { $typenow = 'post'; $current_screen->id = $typenow; $current_screen->post_type = $typenow; + } elseif ( 'edit-tags' == $current_screen->id ) { + if ( empty($taxnow) ) + $taxnow = 'post_tag'; + $current_screen->id = 'edit-' . $taxnow; + $current_screen->taxonomy = $taxnow; } $current_screen = apply_filters('current_screen', $current_screen);