Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comment Moderation Exp: Add toggle to enable/disable guest comments automatic moderation#751

Merged
dkotter merged 5 commits into
WordPress:developfrom
Intenzi:feat/restrict-comment-moderation-to-logged-users
Jun 22, 2026
Merged

Comment Moderation Exp: Add toggle to enable/disable guest comments automatic moderation#751
dkotter merged 5 commits into
WordPress:developfrom
Intenzi:feat/restrict-comment-moderation-to-logged-users

Conversation

@Intenzi

@Intenzi Intenzi commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #750

Adds a checkbox in Comment Moderation Experiment settings.

This allows enabling/disabling of the comment moderation flow (AI sentiment, toxicity analysis) when the comment user is anonymous.

Set to true/Enabled by default.

Why?

This is in continuation to #516 (comment)

It solves the problem of AI analysis being run on unwanted guest users/ spam of guest comments that can cause a Denial Of Wallet attack.

Additionally enables customization to moderation flow for the website's comment moderators.

How?

  • Registers a settings field of the id moderate_guests as a boolean field. Enabled by default.
  • When disabled, skips the AI sentiment, toxicity analysis for anonymous user comments.
  • Copied structure of Content_Classification.php for settings registration.
  • Additionally increased margin top spacing of inline settings form. This is to prevent the checkbox from looking squeezed in with the experiment's description.

Use of AI Tools

AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini 3.5 Flash (Low)
Used for: Identifying the css file for the css fix, adding the integration tests.

Testing Instructions

  1. Enable Comment Moderation Experiment.

a> With Moderate Guest Comments settings field toggled on:

  • Add a comment as a guest user after logging out / on incognito / etc.
  • Go to Comments section in wp-admin and view that the comment has sentiment, toxicity analysis performed on it.

b> Turn off the Automatically moderate guest comments settings field by clicking on it:

  • Add a comment as a guest user after logging out / on incognito / etc.
  • Go to Comments section in wp-admin and observe that the comment does not have sentiment, toxicity analysis performed on it.

Screenshots or screencast

New Automatically moderate guest comments settings field enabled by default:
image

The setting field, toggled off:
image

Comments added when the setting was toggled off, on.
image

Changelog Entry

Added - Automatically moderate guest comments settings field which skips guest comments moderation when disabled.
Changed - Top margin spacing increased in inline settings form.

Open WordPress Playground Preview

Intenzi added 3 commits June 19, 2026 20:29
- ensures the custom setting fields are not too closely bunched to the experiment description
…ion analysis

- checks for analysis skip when toggle is enabled and when disabled
@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Intenzi <[email protected]>
Co-authored-by: dkotter <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@dkotter

dkotter commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@Intenzi Can you look to clean up the merge conflicts here before I test/review? Thanks!

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 18.51852% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.04%. Comparing base (eae7cd3) to head (0561aba).

Files with missing lines Patch % Lines
...eriments/Comment_Moderation/Comment_Moderation.php 18.51% 22 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #751      +/-   ##
=============================================
- Coverage      76.24%   76.04%   -0.21%     
- Complexity      1765     1770       +5     
=============================================
  Files             85       85              
  Lines           7591     7618      +27     
=============================================
+ Hits            5788     5793       +5     
- Misses          1803     1825      +22     
Flag Coverage Δ
unit 76.04% <18.51%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dkotter dkotter merged commit 1736a36 into WordPress:develop Jun 22, 2026
22 of 24 checks passed
jorgefilipecosta pushed a commit that referenced this pull request Jun 29, 2026
…utomatic moderation (#751)

Added - New setting to choose if guest comments should be moderated or not, defaulting to yes.

Co-authored-by: Intenzi <[email protected]>
Co-authored-by: dkotter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable guest comments from Comment Moderation AI analysis

2 participants