Is it possible to modify comments actions list depending on the current user role?
Yes. Let’s see how to realize this.
Full list of comments actions
Title | Id |
---|---|
Approve | approve |
Unapprove | unapprove |
Reply | reply |
Quick Edit | quickedit |
Edit | edit |
Mark as Spam | spam |
Not Spam | unspam |
Trash | trash |
Restore | untrash |
Delete Permanently | delete |
We will need ID value from the table above in order to modify existing actions list: bulk actions at the drop-down menu and row actions.
For example in order to hide from the user with ‘editor’ role ‘Trash’ and ‘Delete Permanently’ actions we can:
Modify it for your needs adding/replacing needed actions.
You may add this code to the functions.php file or setup it as the “must-use” plugin.