WordPress Questions and Answers (CMA) - Use Case - Filtering Spam and Offensive Content Using ChatGPT


Use Case - Filtering Spam and Offensive Content Using ChatGPT

Back to User Guides

Note: This guide covers features from the Pro version of the WordPress Questions and Answers - This document uses version 4.9.1.

Introduction

The WordPress Questions and Answers plugin creates a simple yet powerful WordPress Discussion Forum that is intuitive to use, easy to manage, and styled similarly to the popular StackOverflow platform. In addition to posting automatically generated answers in selected categories using ChatGPT, the plugin can leverage ChatGPT to filter user-generated content - blocking spam and offensive language before it appears on your forum.

Use Case Front-End

Example of filtering spam content using AI:

Front-end example - WordPress Question and Answer Plugin
Front-end example

Use Case Assumptions

In this example use case guide, we will show how to configure ChatGPT integration for your WordPress discussion forum. The guide focuses on enabling AI-powered filtering of user-generated content to detect spam and offensive language before it appears on the forum.

We consider that you have already bought the plugin, but not installed it. 

It follows:

Installing the Plugin

The process is the same for all CM plugins.

CreativeMinds Customer Account Dashboard - Downloads tab
CreativeMinds Customer Account Dashboard
  • Download the plugin from your customer dashboard.
  • Log in to WordPress and navigate to the WordPress Admin  → Plugins settings.
  • Click on Add New.
  • Activate it and add the license.

Learn more: Getting Started - Installation And First Steps


Quick Recap

This use case guide is focused on the setting up the ChatGPT integration for posting automatic answers. We recommend you first to configure the base plugin settings. Learn more about it in this use case guide:

It will help to configure the following:

  • Creating and set up of a forum
  • Adding Forum to Site
  • User area and user area shortcodes
  • Changing the look and fill
  • Restricting access of the forum
  • Moderating questions
  • Enabling notifications for questions and answers
  • Translating the forum interface

What is ChatGPT?

ChatGPT is an AI chatbot developed by OpenAI that uses natural language processing and machine learning to generate human-like responses based on user input.

ChatGPT processes text using Tokens - small units of words or characters that the model uses for understanding language. For English text, one token is roughly four characters or about three-quarters of a word. Each time the plugin sends a request to ChatGPT, tokens are consumed.

To use the API, you need to have a valid payment method on your OpenAI account. Every request consumes tokens, which are billed according to OpenAI’s pricing.

To connect your forum with ChatGPT, you need to obtain an API key from your OpenAI account.

Creating API Key

To get the API key, please do the following:

  1. Go to the OpenAI Platform.
  2. Sign in to your OpenAI account or create a new one.
  3. Open your profile menu (top right corner) and select View API keys.
  4. Click Create new secret key.
  5. Copy the generated key and store it in a safe place - it provides access to your account.

Because this process is handled by a third-party service, the exact interface might change from time to time. Follow the instructions shown on the OpenAI website when creating your API key.

Enabling ChatGPT Integration On Your Site

First, we need to enable the integration with ChatGPT. To configure it, navigate to Admin Dashboard → CM Answers Pro → Settings → General tab → ChatGPT section.

Navigation to ChatGPT settings - WordPress Forum Plugin
Navigation to ChatGPT settings

The options we need in this section are:

ChatGPT integration settings - Questions and Answers Forum Plugin
ChatGPT integration settings
  • Enable Chat_GPT - Turn on this option to activate ChatGPT feature.
  • Chat GPT API Key - Enter here the API key obtained from OpenAI site.
  • Chat GPT Model - This option is inactive until you enter your API key in the option above and save the changes. Once it's done, you will be able to choose any model supported by your API in the dropdown.

After setting up these options, click the button Update at the bottom of the page.

Saving the changes - WordPress Questions and Answers
Saving the changes

TIP

Learn more about configuring automatic answers with ChatGPT in this use case guide:

Posting Content With AI Filter

Even if you don't enable manual moderation for questions and answers, when AI filtering is enabled, the content is not posted immediately. AI checking can take some time, which may result in a longer loading time and a poor user experience.

To avoid this, when a user posts a question, answer or comment, they will see a message that the content is being held for moderation. After the AI check is complete, the content is either published on the forum or, if it was removed or marked as spam, the author will receive an email notification.

Configuring Spam Filter Settings

To adjust spam filter settings, navigate to the Admin Dashboard â†’ CM Answers Pro â†’ Settings → Thread tab, then expand the Spam Reporting section.

Navigation to spam reporting settings - WordPress Discussion Forum
Navigation to spam reporting settings

This section includes basic options that allow users to report spam manually, as well as settings to enable AI-based spam filtering using ChatGPT. We'll cover the options in the following order:

  1. Manual spam reporting options.
  2. AI-based spam filtering settings.
Spam reporting settings - Q and A Plugin
Spam reporting settings

Manual Spam Report Settings

Basic spam reporting settings - WordPress Q and A Plugin
Basic spam reporting settings
  • Enable spam reporting for questions/answers - Choose Yes to turn on the spam reporting feature.
  • Allow guests to report a spam - If set to Yes then non-logged users will also be able to report spam.
  • Send spam report to an email address - Enter one or multiple email addresses to send spam reports to. If you add multiple emails, separate them by comma.
  • Spam report email subject - Customize the email subject template.
  • Spam report email template - Customize the email body template. Both email subject and email body templates accept the following shortcodes for adding dynamic content:
    • [blogname]  - name of the site.
    • [url]  - URL of the site (supported for email body only).
    • [title]  - the title of the question or the question that the answer belongs to.
    • [author]  - name of the author.
    • [content]  - rejected content.
    • [user]  - username of the author.
    • [datetime]  - date posted.
    • [trash]  - quick link to move question or answer to trash (supported for email body only).
    • [spam]  - quick link to mark the question as spam (supported for email body only).

Front-end Example

Below is a frontend example of the link that will appear that allows users to report questions and answers as spam.

The link for reporting spam - WordPress Question and Answer Plugin
The link for reporting spam

After clicking the link, the user will see a message that the report has been sent, and the content will be marked as spam.

Example of marking spam - WordPress Forum Plugin
Example of marking spam

Settings for Checking for Spam Using AI

Settings for checking for spam using AI - Questions and Answers Forum Plugin
Settings for checking for spam using AI
  • Enable spam filtering by AI - Choose Yes to turn on the AI spam filtering feature.
  • Which AI should be used to filter spam - You can choose which AI service to use for filtering: ChatGPT or Gemini. In this use case we choose ChatGPT.
  • Prompt for AI to detect spam - This is a prompt that will be sent to the AI service. We recommend to keep the default prompt, but you can customize it according to your needs. The prompt must contain the shortcode [content]  in order to pass the content of the question/answer to AI for checking. The part of the prompt "Answer true or false only" also must be kept, as the plugin algorithm blocks the content if it receives the answer "true".
  • Spam filtering action - You can choose what to do with spam detected questions or answers:
    • Delete content
    • Move to trash
    • Mark as spam
  • Enable email notifications for AI-detected spam rejections - Enable this option if you want to notify the author of the content if their question or answer was rejected.
  • Email subject for the AI-detected spam notification - Customize the email subject template.
  • Email template for the AI-detected spam notification - Customize the email body template. Both email subject and email body templates accept the following shortcodes for adding dynamic content:
    • [blogname]  - name of the site.
    • [type]  - type of the rejected content: question or answer.
    • [question_title]  - the title of the question or the question that the answer belongs to.
    • [content]  - rejected content.
    • [fragment]  - first 100 characters of the rejected content.
    • [date]  - date posted.

Front-end Example

As we chose the option Mark as spam, after the user posts a question or answer that contains spam, it takes some time to verify it using ChatGPT. If it contains spam, the content will be marked with a relevant label - "Marked as spam".

Front-end example - WordPress Questions and Answers
Front-end example

While ChatGPT is checking the content for spam, it has a status Pending.

Content status while checking for spam - WordPress Discussion Forum
Content status while checking for spam

Filter Content With Inappropriate Words

To adjust bad words filter settings, navigate to the Admin Dashboard â†’ CM Answers Pro â†’ Settings → Thread tab, then expand the Bad words section.

Navigation to bad words settings - Q and A Plugin
Navigation to bad words settings

This section includes options to filter questions, answers, and comments that contain inappropriate or offensive language. Admins can either define a list of pre-set words that are not allowed on the forum, or enable AI-based filtering using ChatGPT to automatically detect inappropriate content.

We'll cover the options in the following order:

  1. Manual settings with a list of pre-defined words
  2. AI-based bad words filtering settings
Bad words settings - WordPress Q and A Plugin
Bad words settings

Basic Settings

Basic bad words settings - Questions and Answers Plugin
Basic bad words settings
  • Enable bad words filter - If enabled, the question, answer or comment which includes a bad word won't be accepted.
  • Bad words list - Separate each bad word by new line. You can also use regular expressions (compatible with preg_match() in PHP) by wrapping the expression by slashes, for example: /(bad )?words?/.

Front-end Example

Below is a frontend example of the forbidden word in the answer, and the reaction to it.

Example of the answer with offensive word - WordPress Question and Answer Plugin
Example of the answer with offensive word

Instead of posting the answer, the user will see a message explaining why their answer was not posted.

Blocking the answer with offensive word - WordPress Forum Plugin
Blocking the answer with offensive word

Settings for Checking for Inappropriate Language Using AI

Settings for checking for inappropriate language using AI - Questions and Answers Forum Plugin
Settings for checking for inappropriate language using AI
  • Enable bad words filtering by AI - Choose Yes to turn on the AI bad words filtering feature.
  • Which AI should be used to filter bad words - You can choose which AI service to use for filtering: ChatGPT or Gemini. In this use case we choose ChatGPT.
  • Prompt for AI to detect bad words - This is a prompt that will be sent to the AI service. We recommend to keep the default prompt, but you can customize it according to your needs. The prompt must contain the shortcode [content]  in order to pass the content of the question/answer/comment to AI for checking. The part of the prompt "Answer true or false only" also must be kept, as the plugin algorithm blocks the content if it receives the answer "true".
  • Bad words filtering action - You can choose what to do with the content that contains inappropriate language:
    • Delete content
    • Move to trash - Let's choose this option for our use case.
  • Enable email notifications for AI-detected bad-words rejections - Enable this option if you want to notify the author of the content if their question/answer/comment was rejected.
  • Email subject for the AI-detected bad-words notification - Customize the email subject template.
  • Email template for the AI-detected bad-words notification - Customize the email body template. Both email subject and email body templates accept the following shortcodes for adding dynamic content:
    • [blogname]  - name of the site.
    • [type]  - type of the rejected content: question or answer.
    • [question_title]  - the title of the question or the question that the answer belongs to.
    • [content]  - rejected content.
    • [fragment]  - first 100 characters of the rejected content.
    • [date]  - date posted.

Front-end Example

After the user posts some content, it is held for moderation.

Front-end example - WordPress Questions and Answers
Front-end example

While ChatGPT is checking the content for inappropriate content, it's not published:

Holding content for moderation - WordPress Discussion Forum
Holding content for moderation

As a result, the content is moved to the Trash folder.

Moving content to trash - Q and A Plugin
Moving content to trash

Translating Front-end Labels

When posting question, answers or comments, the user can see messages about holding the content for moderation:

Example of the front-end message - WordPress Q and A Plugin
Example of the front-end message

You can edit these messages, as all other front-end labels by navigating to Admin Dashboard → CM Answers Pro → Settings → Labels tab:

Labels settings - Questions and Answers Plugin
Labels settings

TIP

Learn more about plugin labels:

End Result

Following instructions found in the plugin and guides, you should be able to enable AI-powered filtering of user-generated content to detect spam and offensive language before it appears on the forum.

Use Case Front-End

Example of filtering spam content using AI:

Front-end example - WordPress Question and Answer Plugin
Front-end example

More information about the WordPress Questions and Answers plugin

Other WordPress products can be found at CreativeMinds WordPress Store

Let us know how we can Improve this Product Documentation Page

To open a Support Ticket visit our support center
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.