Make WordPress Core

Ticket #28080: 28080.3.patch

File 28080.3.patch, 1.6 KB (added by rachelbaker, 8 years ago)

Minor refresh. Strictly checks the post_status string and adds missing period to inline comment

  • 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
     274        // Comments meta box.
     275        if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) {
     276                add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core' );
     277        }
     278}
    271279
    272280if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
    273281        add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');