WordPress Questions and Answers (CMA) - Use Case - Filtering Spam and Offensive Content Using Gemini
Use Case - Filtering Spam and Offensive Content Using Gemini
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 Gemini, the plugin can leverage Gemini 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:

Use Case Assumptions
In this example use case guide, we will show how to configure Gemini integration for your WordPress discussion forum. The guide focuses on enabling AI-powered filtering of user-generated content - blocking spam and offensive language before it is published.
We consider that you have already bought the plugin, but not installed it.
It follows:
- Installing the plugin
- Quick recap
- What is Gemini?
- Creating API key
- Enabling Gemini integration on your site
- Posting content with AI filter
- Configuring spam filter settings
- Filter content with inappropriate words
- Translating front-end labels
- End result
Installing the Plugin
The process is the same for all CM plugins.

- 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 Gemini 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 Gemini?
Gemini, also known as Bard, is an AI chatbot developed by Google. It uses a large language model (LLM) to generate human-like responses based on user input. Gemini has evolved from earlier Google models, including LaMDA and PaLM, and is continuously updated to improve its conversational capabilities.
Creating API Key
To integrate Gemini with WordPress Questions and Answers, you need an API key.
- Go to Google AI Studio and sign in or create a new account.
- Complete any required account verification steps, such as verifying your phone number.
- Open the API Keys section in your account.
- Click Create API key and copy the generated key.
- Keep your API key private and secure - it provides access to your account and services. You will need this key when configuring the plugin.
Important: The process for obtaining an API key is managed on Google’s platform, so the interface may change over time. Follow the instructions on the site if you see any differences.
Enabling Gemini Integration On Your Site
First, we need to enable the integration with Gemini. To configure it, navigate to Admin Dashboard → CM Answers Pro → Settings → General tab → Gemini section.

The options we need in this section are:

- Enable Gemini - Turn on this option to activate the Gemini feature.
- Gemini API Key - In order to make the feature work, you need to enter Google AI Studio and obtain there an API key. It's simple - head to the site, sign up and follow the instructions.
- Gemini Model - This option allows you to choose a Gemini 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.

TIP
Learn more about configuring automatic answers with Gemini 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.

This section contains basic options that allow users to report spam manually, along with settings to enable AI-based spam filtering using Gemini. The options will be reviewed in the following order:
- Manual spam reporting options.
- AI-based spam filtering settings.

Manual Spam Report 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.

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

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 Gemini.
TIP
Learn about setting up the same use case for 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 - Let's choose this option for our use case.
- 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 Gemini. If it contains spam, the content will be marked with a relevant label - "Marked as spam".

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

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.

This section contains options to filter questions, answers, and comments that include inappropriate or offensive language. Admins can create a list of forbidden words, or enable AI-based filtering using Gemini to automatically identify inappropriate content.
The options will be reviewed in the following order:
- Manual settings with a list of pre-defined words
- AI-based bad words filtering settings

Basic 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.

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

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 Gemini.
TIP
Learn about setting up the same use case for 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.

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

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

Translating Front-end Labels
When posting question, answers or comments, the user can see messages about holding the content for moderation:

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

End Result
Following instructions found in the plugin and guides, you should be able to enable AI-powered filtering of user-generated content - blocking spam and offensive language before it is published.
Use Case Front-End
Example of filtering spam content using AI:

![]() |
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 |