From e2be537941b5f3a2b717d01ef951a2a54f78f30c Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 14 Nov 2010 20:35:42 +0000 Subject: [PATCH] Don't show author column if the post type doesn't support it. Fixes #15425 git-svn-id: http://svn.automattic.com/wordpress/trunk@16376 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-posts-list-table.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index d46f129536..331e44d850 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -264,17 +264,25 @@ class WP_Posts_List_Table extends WP_List_Table { $post_type = $screen->post_type; $posts_columns = array(); + $posts_columns['cb'] = ''; + /* translators: manage posts column name */ $posts_columns['title'] = _x( 'Title', 'column name' ); - $posts_columns['author'] = __( 'Author' ); + + if ( post_type_supports( $post_type, 'author' ) ) + $posts_columns['author'] = __( 'Author' ); + if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'category' ) ) $posts_columns['categories'] = __( 'Categories' ); + if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'post_tag' ) ) $posts_columns['tags'] = __( 'Tags' ); + $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; - if ( !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) && ( empty( $post_type ) || post_type_supports( $post_type, 'comments' ) ) ) + if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) $posts_columns['comments'] = '
' . esc_attr__( 'Comments' ) . '
'; + $posts_columns['date'] = __( 'Date' ); if ( 'page' == $post_type )