Remove the Comments page when removing the moderate_comments capability
-
I have a user set up with the role of an Author, who needs to retain the capability of editing posts while not being able to upload files or moderate comments. I’ve added the following to my theme’s
functions.php
:$edit_admin = get_role('author'); $edit_admin->remove_cap('upload_files'); $edit_admin->remove_cap('moderate_comments');
However, while the Media Library page is removed from the user’s dashboard when the
upload_files
capability is removed, the Comments menu item remains even when themoderate_comments
capability is removed.I’ve noticed that the Codex says that the Comments page’s visibility is linked to the
edit_posts
capability, but this doesn’t make any sense to me. If I have decided to remove themoderate_comments
capability from a particular user, it seems logical that I don’t want that user to continue seeing the Comments that are made, as the page is then of no use to them.What was the rationale of implementing the
moderate_comments
capability in this way, and is there any possibility of making it so that when it is explicitly removed the Comments page is also removed?
- The topic ‘Remove the Comments page when removing the moderate_comments capability’ is closed to new replies.