#28080 closed defect (bug) (fixed)
Commenting possible on custom post type after support for commenting removed from CPT.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.9 |
Component: | Comments | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
I have found that if a custom post type is created with support for comments, and post in that CPT exist, when removing support for comments from the CPT, it is still possible to post comments on existing posts in the CPT. Since the CPT no longer supports comments, there are no discussion controls available in the post editor so discussion can not be manually disabled for the posts created before support for comments was removed from the CPT.
I am testing with trunk (4.0 alpha) and Twenty Fourteen.
Attachments (4)
Change History (18)
@
10 years ago
Enables comment meta boxes for posts that have comments enabled and/or actual comments.
#3
@
10 years ago
I was able to reproduce this.
Simply removing custom post type support for comments does not mean that comments are disabled for a post. I believe that is the correct logic. In some cases, an admin may want to keep the existing comments on those posts, even if comments are eventually disabled for the entire post type ( or if they use a plugin to convert the post type to another post type ) .
Currently: Post comment meta boxes ( discussion and comments ) are only visible based on the check for post_type_supports()
for comments.
The patch above adds a check for comments_open()
or pings_open()
to show the discussion meta box.
And adds an additional check for comment_count > 0
to show the comments meta box.
So, if a post has comments or pings enabled, the admin will still be able to disable comments / pings using the post_comment_status_meta_box()
, and moderate existing comments on the post using the post_comment_meta_box()
, even if the post type no longer supports comments.
#5
@
10 years ago
Notes:
Check for post_type_supports(), and if disabled, remove discussion box, and disable comments on front-end.
Check for existing comments and display comments meta box.
#6
@
10 years ago
- Keywords good-first-bug added
- Milestone changed from Awaiting Review to 4.2
- Owner set to couturefreak
- Status changed from new to assigned
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 helen. View the logs.
10 years ago
#11
@
9 years ago
- Milestone changed from Future Release to 4.4
28080.diff is a refresh, let's see what is up here now that #31168 is sorted
@
9 years ago
Minor refresh. Strictly checks the post_status string and adds missing period to inline comment
#12
@
9 years ago
- Keywords commit added; needs-testing good-first-bug removed
Tested @wonderboymusic's patch and it looks good to me. I refreshed it with a few minor changes.
+1
Related: #12991, #27111.