I already know how to remove a metabox from my custom post type edit page. However I want to remove the comments metabox but still allow commenting for the post. Because I notice when I do remove it, it disables comments. Any function I can use?
Leave a Reply
You must be logged in to post a comment.
Don’t remove this via CSS. The _POST part is also active and WP save the data!
Use the hooks to remove meta boxes; code by scratch.
see more on a plugin to remove all UI-elements and function for comments: https://github.com/bueltge/Remove-Comments-Absolutely
You can use the UI to remove it:
Click on the “Screen Options” at the top right side of the edit screen
and uncheck the Discussion check box
or if you want to do it by code simply hide the container div by
style="display:none;"
There is problem in file
/wp-includes/post.php
functionwp_insert_post()
Your comments will be close after update. The solution is change callback of commentstatusdiv insted:
Add this in
functions.php
of your themeThis is what I used to hide some of the meta boxes, including the comment status box:
This way the meta boxes will be hidden for all the contributors, but not the administrators.
In the second function
comment_status
is set to"open"
only when the same conditions are met that caused the comments to be disabled in the first place.