Developers · What Stop comment spam does

Developers

Stop Comment Spam

What the Stattery WordPress plugin does with each new comment when Stop comment spam is on, which comments it checks, and how it behaves when something goes wrong.

Turning It On

The switch is per site, under Settings, Bots, Rules, Stop comment spam. The plugin picks the setting up with the rest of its rules from Stattery, so there is nothing to change in WordPress. It needs plugin 0.9.25 or later; older plugins ignore the setting.

Where It Hooks In

The plugin adds a pre_comment_approved filter at priority 99, so it runs after WordPress and most other plugins have made their own call. Because WordPress runs that filter for every new comment, the same check covers wp-comments-post.php, the REST API (/wp/v2/comments) and XML-RPC.

For each comment, the plugin asks Stattery whether the visitor behind it is a person, using the visitor’s address and the visitor id that Stattery’s tracking script already keeps. The question is signed with the site’s plugin key, so only your own site can ask about your visitors. From plugin 0.9.27 it also carries the first 200 characters of the comment, the commenter’s name and the post’s title, so a refused or held comment can be shown to you in Stopped for you. They are kept only for comments that are refused or held, are never used to decide, and the email address is never sent.

The Three Answers

  • Person: the plugin returns WordPress’s own decision unchanged. Your Discussion settings (hold first-time commenters, link limits, disallowed words) still apply.
  • Bot: the plugin returns a WP_Error with the code stattery_comment_refused and status 403. WordPress stops and the comment is never saved. The visitor sees: Sorry, this comment could not be accepted.
  • Not sure: the plugin returns 0, so the comment is saved as pending. With Refuse comments from visitors who never viewed a page on (the default), a visitor Stattery never saw view a page on the site gets the Bot answer instead. A page view the Edge Observer saw counts too, so a reader whose ad blocker stops the tracking script is still held, not refused. On a site with no Edge Observer reporting, Stattery can’t tell those readers apart, so the comment is held. It adds the comment meta stattery_hold with a plain reason, shown in a Stattery column on the Comments screen while the switch is on.

What Is Never Checked

  • Comments already marked spam or trash, or already refused by another plugin (a WP_Error passed in).
  • Comments from signed-in users (any comment with a user_id).
  • Comments on anything other than the post post type, so pages and WooCommerce product reviews are left alone.
  • Comment types other than comment, pingback and trackback.

When Stattery Can’t Be Reached

If the request fails, times out or gets an answer the plugin doesn’t understand, the comment is held as pending with the reason Stattery couldn’t be reached. Comments are never refused because of a network problem, and never posted unchecked while the switch is on.