WordPress.org

Make WordPress Core

Changeset 16376


Ignore:
Timestamp:
11/14/2010 08:35:42 PM (10 years ago)
Author:
scribu
Message:

Don't show author column if the post type doesn't support it. Fixes #15425

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-posts-list-table.php

    r16368 r16376  
    265265
    266266        $posts_columns = array();
     267
    267268        $posts_columns['cb'] = '<input type="checkbox" />';
     269
    268270        /* translators: manage posts column name */
    269271        $posts_columns['title'] = _x( 'Title', 'column name' );
    270         $posts_columns['author'] = __( 'Author' );
     272
     273        if ( post_type_supports( $post_type, 'author' ) )
     274            $posts_columns['author'] = __( 'Author' );
     275
    271276        if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'category' ) )
    272277            $posts_columns['categories'] = __( 'Categories' );
     278
    273279        if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'post_tag' ) )
    274280            $posts_columns['tags'] = __( 'Tags' );
     281
    275282        $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
    276         if ( !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) && ( empty( $post_type ) || post_type_supports( $post_type, 'comments' ) ) )
     283        if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) )
    277284            $posts_columns['comments'] = '<div class="vers"><img alt="' . esc_attr__( 'Comments' ) . '" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>';
     285
    278286        $posts_columns['date'] = __( 'Date' );
    279287
Note: See TracChangeset for help on using the changeset viewer.