Antispam for Contact Form 7

How the Antispam works with Contact Form 7

Plugin hooks into the Contact Form 7 spam check filter, and checks for spam entries only if the form has coreSecurity support enabled.

To get all the information about how the antispam works, which antispam methods are available, checkout the main Antispam article.

What happens with spam?

If the message is caught and marked as spam, it is deleted by the plugin, and contact message is not sent. Contact Form 7 has no way of saving contact messages in database.

Contact Form 7 Plugin Setup

Due to the way the Contact Form 7 forms are set up, for coreSecurity Antispam to work, we need to make some updates to the forms you want to process with the Antispam feature.

All the changes needed are done for each Contact Form you want. The Contact Forms are location in the WordPress sidebar menu ‘Contact’ -> ‘Contact Forms’. Edit the forms you want to enable for Antispam processing.

Form Main Fields

Because with Contact Form 7, there are no standardized fields that form can or must have, we need to mark existing fields so that coreSecurity knows which forms to map to different processing types.

  • If you want to log field value in the security logs, add coreactivity:log attribute to the fields you want logged.
  • To mark field as an email field, add coresecurity:email attribute to one field only.
  • To mark field as a name field , add coresecurity:name attribute to one field only.
  • To mark field as a title field, add coresecurity:title attribute to one field only.
  • To mark field as a content field, add coresecurity:content attribute to one field only.
  • To mark field as a URL field, add coresecurity:url attribute to one field only.

Here is the default Contact Form 7 form:

<label> Your name
    [text* your-name autocomplete:name] </label>

<label> Your email
    [email* your-email autocomplete:email] </label>

<label> Subject
    [text* your-subject] </label>

<label> Your message (optional)
    [textarea your-message] </label>

[submit "Submit"]

With the additional attributes, this form will look like this:

<label> Your name
    [text* your-name autocomplete:name coresecurity:name coreactivity:log] </label>

<label> Your email
    [email* your-email autocomplete:email coresecurity:email coreactivity:log] </label>

<label> Subject
    [text* your-subject coresecurity:title coreactivity:log] </label>

<label> Your message (optional)
    [textarea your-message coresecurity:content] </label>

[submit "Submit"]

Form Additional Settings

In the field for Additional Settings, just add new line with the text:

coresecurity: on
Rate this article

You are not allowed to rate this post.

Leave a Comment