WordPress.org

Make WordPress Core

Opened 13 months ago

Last modified 5 months ago

#24486 new defect (bug)

The 'commentsdiv' meta box isn't displayed when using custom post statuses

Reported by: XyntaMan Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.8
Component: Comments Keywords: has-patch
Focuses: administration Cc:

Description

The 'commentsdiv' meta box, which shows comments to a post in the admin post edit section (and also gives the ability to post additional comments straight from there) isn't displayed when the post is set to any non-publish or non-private post status, particularly any custom post status.

As far as I can tell, the problem arises from the fact that the said meta box is initialized in "wp-admin/edit-form-advanced.php", where the conditional expression for its initialization has the "publish" and "private" post statuses hardcoded in:

if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') )
	add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core');

The existing code is disabling the initialization of the 'commentsdiv' meta box in any use case with custom post statuses, reducing their usefulness and flexibility.

In my opinion, the the simplest fix for this would be to remove the post status check as a condition for the 'commentsdiv' meta box initialization, leaving the "post_type_supports($post_type, 'comments')" as the only condition:

if ( post_type_supports($post_type, 'comments') )
	add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core');

Attachments (1)

commentsdiv.24486.diff (793 bytes) - added by XyntaMan 13 months ago.
Fix for the bug

Download all attachments as: .zip

Change History (4)

XyntaMan13 months ago

Fix for the bug

comment:1 XyntaMan13 months ago

  • Keywords has-patch added

comment:2 SergeyBiryukov13 months ago

  • Version changed from 3.5.1 to 2.8

Introduced in [10480].

comment:3 jeremyfelt5 months ago

  • Component changed from Administration to Comments
  • Focuses admin added
Note: See TracTickets for help on using tickets.