Comments: allow meta boxes for Discussion and Comments in extenuating circumstances.

* Discussion: Post Type stops supporting comments, but comments and/or pings are open on a post. 
* Comments: Post is published or private, the post type has stopped supporting comments, but comments and/or pings are open on a post.

Currently, there is no way to toggle those settings off.

Props couturefreak, wonderboymusic, rachelbaker.
Fixes #28080.

Built from https://develop.svn.wordpress.org/trunk@34461


git-svn-id: http://core.svn.wordpress.org/trunk@34425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-23 19:49:26 +00:00
parent 3c028a80d4
commit 652a3030e1
2 changed files with 13 additions and 5 deletions

View File

@ -263,11 +263,19 @@ if ( post_type_supports($post_type, 'custom-fields') )
*/
do_action( 'dbx_post_advanced', $post );
if ( post_type_supports($post_type, 'comments') )
add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
// Allow the Discussion meta box to show up if the post type supports comments,
// or if comments or pings are open.
if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) {
add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core' );
}
if ( ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) && post_type_supports($post_type, 'comments') )
add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
if ( 'publish' === get_post_status( $post ) || 'private' === get_post_status( $post ) ) {
// If the post type support comments, or the post has comments, allow the
// Comments meta box.
if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) {
add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core' );
}
}
if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34460';
$wp_version = '4.4-alpha-34461';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.