Make WordPress Core

Ticket #28080: 28080.diff

File 28080.diff, 1.6 KB (added by wonderboymusic, 8 years ago)
  • src/wp-admin/edit-form-advanced.php

     
    263263 */
    264264do_action( 'dbx_post_advanced', $post );
    265265
    266 if ( post_type_supports($post_type, 'comments') )
    267         add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
     266// Allow the Discussion meta box to show up if the post type supports comments,
     267// or if comments or pings are open.
     268if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) {
     269        add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core' );
     270}
    268271
    269 if ( ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) && post_type_supports($post_type, 'comments') )
    270         add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
     272if ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) {
     273        // If the post type support comments, or the post has comments, allow the Comments meta box
     274        if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) {
     275                add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core' );
     276        }
     277}
    271278
    272279if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
    273280        add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');