Opened 12 years ago
Closed 9 years ago
#24486 closed defect (bug) (fixed)
The 'commentsdiv' meta box isn't displayed when using custom post statuses
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.4 | 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 (3)
Change History (13)
#4
follow-up:
↓ 5
@
10 years ago
- Milestone changed from Awaiting Review to 4.2
Instead of removing the post_status check, we should check that any custom post statuses are public.
#5
in reply to:
↑ 4
@
10 years ago
- Keywords needs-testing added
Replying to rachelbaker:
Instead of removing the post_status check, we should check that any custom post statuses are public.
Added a patch that uses the get_post_stati() function to return all public statuses, with the fallback being only the public status. I've tested with some custom statuses (stati?) and it works for me.
This ticket was mentioned in Slack in #core by drew. View the logs.
10 years ago
This ticket was mentioned in Slack in #core by drew. View the logs.
10 years ago
#8
@
10 years ago
- Milestone changed from 4.2 to Future Release
Hi @Thaicloud, on 24486.2.diff, I'd suggest probably just including the 'private' status in the fallback array if $stati
is empty, therefore removing the need for the 'private' condition.
We're going to punt this to a future release as this can currently be worked around by adding the meta box yourself.
Fix for the bug