Stop spam comments, create a WordPress comment moderator role

All websites that allow commenting on posts attract spam comments. Create a comment moderator role in WordPress and assign it to someone to help you filter out the junk messages on your site.

Spam comments is a constant problem that never goes away and it only seems to get worse over time. There are ways to combat it and if your website does not get too many junk comments on articles, there are some simple methods that can cut most spam.

You may not have realized it, but WordPress has built-in features that enable you to block spam. See my article, How to stop spam comments on your blog or website without plugins. I used that method for a while and I would estimate that it cut out about 90% of spam. I have forums on this site these days, so I pay for an anti-spam plugin to protect them, see Stop blog and website comment spam with CleanTalk for WordPress.

Whether you use WordPress built-in features or an anti-spam plugin, some junk comments still make it through. Do you have the time to deal with spam comments or is your time better spent on more important things? Why not get someone else to help you manage spam? Create a WordPress comment moderator role, assign it to someone you trust and let them deal with the spam while you get on other tasks.

There are a couple of ways to do this and the first one I look is at is interesting because it demonstrates how to create WordPress roles, assign permissions and restrict what users can do. You can learn a lot from this method.

What is a WordPress role?

A WordPress role is a set of permissions that determine what a user is allowed to do. When a user creates an account on a WordPress site, they are assigned a role: Subscriber, Contributor, Author, Editor or Admin.

For example, the contributor role allows the user to create, edit and delete their own posts. An author can also publish their own posts. An editor can create, edit, publish and delete not only their own posts, but everyone else’s too. They have complete authority over everything that is published on the site.

An editor is just one level below admin, which is total control. It is therefore frustrating and risky that if you want to enable a user to manage comments and deal with spam, you must make them an editor, giving them almost complete control over the site.

Create a Content Moderator WordPress role

It is possible to create additional roles in WordPress and assign whatever permissions you want them to have. We can create a role that enables a user assigned to it to manage comments and delete spam without giving them total control over the site. A content moderator would have the minimum permissions to do the job and no more.

User Role Editor WordPress plugin.
Install User Role Editor WordPress plugin

There are several WordPress plugins that enable you to do this, like WPFront User Role Editor and User Role Editor, which I use here. Go to Plugins, click New and then install it and activate it.

Create a new WordPress role with User Role Editor plugin.
Create new WordPress user roles with User Role Editor

Go to Users > User Role Editor and you can view permissions for the role selected at the top,like Subscriber. Click the Add Role button on the right.

User Role Editor plugin for WordPress.
Create a new WordPress user role from an existing one

Content moderation can be added to any of the roles that do not have it, like author, contributor and subscriber. Let’s base our new role on the one with the least permissions, subscriber, by making a copy of it. Name it something descriptive like Content Moderator.

Permissions for a WordPress user.
View and edit user role permissions in WordPress

The new role is automatically selected and all WordPress permissions are listed. The ones that are active for the selected role are ticked and you can see that only one is selected. That is because we based the role on subscriber and all a subscriber can do is read posts.

WordPress permissions for  a comment moderator.
Necessary permissions for a WordPress comment moderator role

Find and tick edit_others_posts, edit_posts, edit_published_posts, moderate_comments, and read. In the screenshot I selected Granted Only to show only enabled permissions so it is easier to see.

This is the minimum set of permissions required to enable a user to manage comments. You might think that simply selecting moderate_comments would be sufficient, but it is not. The three edit_ permissions are required too.

Change a user's role in WordPress.
Set a user’s role in WordPress.

Now go to Users and select a user by ticking the checkbox. Select Comment Moderator in the role list at the top and then click the Change button to make this user a content moderator.

Manage WordPress comments.
Manage WordPress comments

When this person is logged into WordPress and accesses the admin interface, like their profile or dashboard, they can select Comments in the sidebar. An actions toolbar appears when the mouse hovers over a comment and they can Approve, Reply, Quick Edit, Spam or Trash it. This user can now manage all your comments, just like an admin, reducing your workload, but without all the other permissions that go with an admin or editor.

Potential problems with content moderator role

Only give this role to someone you really trust because they have the power to delete all comments on your site. If they leave your site, change their role back to something else, like subscriber, so they can no longer access comments.

The permissions required for comment management also enable the user to edit posts. This can be seen in the permissions a couple of screenshots back. They cannot publish anything, so they can’t change the front end of the site, but they can change posts and save it as a pending draft in the back end. Admins and editors can decline pending posts and revert back to the original, but it is inconvenient and it is best only to make people you trust content moderators.

Use a content moderation plugin

The main problem with the comment moderator role we created is that it enables post editing. For this reason, plugins have been created that solves the problem. Comment Moderation Role by WPBeginner and Comment Moderator WordPress plugins create a comment moderator role, but prevents them from editing posts. They basically hide the Posts menu in the admin sidebar and make it inaccessible, even if the URL is entered directly.

Leave a Reply