KO Comment Moderator
WordPress Ability die AI gebruikt om comments te analyseren op spam en toxiciteit
by KeurigOnline · github.com/keurigonline/ko-comment-moderator · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/keurigonline/ko-comment-moderator/archive/refs/heads/main.zipEen WordPress Ability die AI gebruikt om comments te analyseren op spam en toxiciteit.
Gebouwd voor WordPress 6.9+ met de Abilities API en Neuron AI.
Installatie
Vereisten
- WordPress 6.9+
- PHP 8.0+
- OpenAI API key (of gebruik demo mode)
Stap 1: Plugin installeren
# Via WP-CLI
wp plugin install https://github.com/keurigonline/ko-comment-moderator/releases/latest/download/ko-comment-moderator.zip --activate
# Of download en upload naar /wp-content/plugins/
Opmerking: De
vendor/directory is meegeleverd. Je hoeft geencomposer installuit te voeren.
Stap 2: Configureren
Ga naar Instellingen → Comment Moderator in WordPress admin.
Blog tutorial
Volledige stap-voor-stap handleiding beschikbaar!
Deze plugin is onderdeel van onze tutorial serie over de WordPress Abilities API. Leer hoe je zelf een AI-powered Ability bouwt met Neuron v2.
De tutorial behandelt:
- Neuron AI agent bouwen met tools
- Email verificatie tool maken
- Ability registratie met
wp_register_ability() - Demo mode voor testen zonder API kosten
- Automatische moderatie van nieuwe comments
Technische documentatie
Systeemarchitectuur
┌─────────────────────────────────────────────────────────────────────────────┐
│ KO Comment Moderator │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────┐ ┌────────────────────┐ ┌───────────────────┐ │
│ │ Client │ │ Neuron Agent │ │ AI Provider │ │
│ │ │ │ │ │ │ │
│ │ • WP-CLI │─────▶│ • System prompt │─────▶│ • OpenAI API │ │
│ │ • REST │ │ • Tools │ │ • gpt-5-nano │ │
│ │ • PHP │ │ • Structured out │ │ │ │
│ └──────────┘ └────────────────────┘ └───────────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────┐ ┌────────────────────┐ ┌───────────────────┐ │
│ │ Input │ │ Tools │ │ Output │ │
│ │ │ │ │ │ │ │
│ │ text │ │ • verify_email │ │ • spam_score │ │
│ │ author │ │ (MX lookup) │ │ • action │ │
│ │ email │ │ │ │ • reason │ │
│ └──────────┘ └────────────────────┘ └───────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Ability registratie
add_action( 'wp_abilities_api_init', function() {
wp_register_ability(
'keurigonline/moderate-comment',
array(
'label' => 'Moderate Comment',
'description' => 'Analyzes a comment for spam and toxicity using AI',
'category' => 'moderation',
'input_schema' => array(
'comment_text' => array( 'type' => 'string', 'required' => true ),
'comment_author' => array( 'type' => 'string' ),
'comment_author_email' => array( 'type' => 'string' ),
),
'output_schema' => array(
'spam_score' => array( 'type' => 'number' ),
'action' => array( 'type' => 'string' ),
'reason' => array( 'type' => 'string' ),
),
'execute_callback' => array( Ability::class, 'execute' ),
)
);
});
Gebruik
REST API
curl -X POST "https://site.nl/wp-json/wp-abilities/v1/abilities/keurigonline/moderate-comment/run" \
-H "Authorization: Bearer APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"input": {"comment_text": "Great article!", "comment_author": "Jan"}}'
WP-CLI
wp abilities run keurigonline/moderate-comment --input='{"comment_text": "Great article!", "comment_author": "Jan"}'
PHP
$ability = wp_get_ability( 'keurigonline/moderate-comment' );
$result = $ability->execute( array(
'comment_text' => 'Great article!',
'comment_author' => 'Jan',
'comment_author_email' => 'jan@example.com',
) );
Input/output schema
| Input | Type | Verplicht | Beschrijving |
|---|---|---|---|
comment_text |
string | Ja | De comment tekst om te analyseren |
comment_author |
string | Nee | Naam van de auteur |
comment_author_email |
string | Nee | Email van de auteur (voor verificatie bij URLs) |
| Output | Type | Beschrijving |
|---|---|---|
spam_score |
number | Spam waarschijnlijkheid (0.0 - 1.0) |
action |
string | Aanbevolen actie: approve, hold, reject, spam |
reason |
string | Korte uitleg voor de beslissing |
Demo modus
Test zonder API key via Instellingen → Comment Moderator en schakel "Demo modus" in.
In demo modus wordt pattern matching gebruikt:
- Spam keywords (casino, viagra, etc.) → spam
- Te veel links (>2) → spam
- Fake email domein + URLs → spam
- Korte comments (<10 chars) → hold
- Overig → approve
Licentie
GPL v2 of later — Gebouwd door KeurigOnline