TUTORIAL8 min read
WordPress

WordPress Plugin Guide

A complete walkthrough for installing, configuring, and getting the most out of the SafeComms WordPress plugin. No coding required.

What You'll Build

By the end of this guide, your WordPress site will automatically moderate posts and comments in real-time. Here is what the plugin provides:

Auto-Moderation

Posts and comments are scanned automatically when published or submitted.

Dashboard & Logs

A dedicated admin page shows all moderation decisions with full category scores.

Plugin Hooks

Integrate with bbPress, WooCommerce, Contact Form 7, and any plugin using WordPress hooks.

Step 1: Install the Plugin

System Requirements

WordPress 5.8 or higher
PHP 8.0 or higher
Outbound HTTPS access to api.safecomms.dev

Installation Steps

1. Download the Plugin

Download the latest safecomms-moderation.zip from the GitHub Releases page.

2. Upload to WordPress

In your WordPress admin, go to Plugins → Add New → Upload Plugin. Select the zip file and click Install Now.

3. Activate

Click Activate Plugin. You will see a new SafeComms menu item in your WordPress sidebar.

Step 2: Connect Your API Key

You need a SafeComms API key to connect the plugin. There are two ways to configure it:

Option AEasiest

Admin Settings

Navigate to Settings → SafeComms in your WordPress dashboard. Paste your API key into the "API Key" field and click Save.

Option BMost Secure

wp-config.php

Add the constant to your wp-config.php to lock the key in code:

wp-config.php
// wp-config.php
define('SAFECOMMS_API_KEY', 'sk_live_your_api_key_here');

Step 3: Configure Moderation Settings

The Settings page gives you fine-grained control over what gets moderated and how.

P

Scan Posts

Automatically scans post titles and content when published or updated. Flagged posts are set to Draft and the author is notified.

C

Scan Comments

Scans new comments before approval. Toxic comments are marked as Spam or Unapproved instantly.

R

Text Replacement Starter+

Instead of blocking content, replace toxic words with asterisks (e.g., f***). Requires the Starter plan or higher.

I

PII Redaction Starter+

Automatically strip emails, phone numbers, and other personally identifiable information from posts and comments.

L

Non-English Support Pro

Enable detection for languages other than English. Requires the Pro plan.

F

Fail-Open Mode

If the API is unreachable, allow comments to be posted (pending manual approval) instead of blocking them entirely.

Step 4: Assign Moderation Profiles

Moderation profiles let you apply different rules to different content types. For example, you might want stricter moderation for usernames than for post bodies.

Content TypeProfile SettingSuggested Use
Post TitlePost Title Profile IDStrict. Titles are public-facing and highly visible
Post BodyPost Body Profile IDModerate. Allows more flexibility in long-form content
Comment BodyComment Body Profile IDStrict. Comments are the most common source of abuse
UsernameUsername Profile IDVery strict. Usernames appear everywhere

Tip: Create moderation profiles in your SafeComms Dashboard first, then copy the Profile ID into the WordPress settings.

Step 5: Extend with Custom Hooks

The plugin can integrate with any WordPress plugin that uses standard hooks. This lets you moderate content from bbPress, WooCommerce, Contact Form 7, and more, without writing code.

How Custom Hooks Work

1. Go to Settings → SafeComms → Custom Hooks

2. Enter the WordPress hook name (e.g., bbp_new_reply_pre_content)

3. Set the argument position and array key (if applicable)

4. Choose behavior: Block (reject entirely) or Sanitize (replace bad words)

Popular Hook Examples

PluginHook NameBehavior
bbPress (Replies)bbp_new_reply_pre_contentSanitize
Contact Form 7wpcf7_posted_dataBlock
WooCommercewoocommerce_new_order_note_dataSanitize
Gravity Formsgform_pre_submissionBlock

Monitoring & Logs

The plugin includes a full moderation dashboard inside your WordPress admin.

Moderation Queue

  • • View all scanned posts and comments
  • • Filter by Blocked / Allowed status
  • • See full category scores (toxicity, profanity, etc.)
  • • Manually override moderation decisions
  • • Re-scan items on demand

System Logs

  • • API errors and rate limit events
  • • Retry queue status and history
  • • Token usage tracking with plan limits
  • • Custom hook execution logs
  • • Plugin activation/deactivation events

Shortcodes

Display the moderation status of a post or comment on the frontend using the built-in shortcode.

WordPress Shortcode
<!-- Display moderation status on a post -->
[safecomms_status]

<!-- Display status for a specific post -->
[safecomms_status post_id="123"]

<!-- Display status for a specific comment -->
[safecomms_status comment_id="456"]

Security: By default, the shortcode output is only visible to users who can edit the specific post or comment. Enable "Restrict to admins only" in settings for stricter control.

Troubleshooting

Plugin fails to activate

Ensure your server is running PHP 8.0 or higher. The plugin does not support PHP 7.4.

"Quota Exceeded" errors

Check your usage in the SafeComms dashboard. If you have hit your monthly limit, content will be handled based on your fail-open/fail-closed setting.

Connection issues

Ensure your server can make outbound HTTPS requests to api.safecomms.dev. Check with your hosting provider if firewalls are blocking the connection.

Rate limiting (HTTP 429)

The plugin automatically queues and retries rate-limited requests using WordPress Cron with exponential backoff. Check SafeComms → Logs for retry status.

Next Steps

Your WordPress site is now protected. Here are some ways to extend your setup:

  • Create custom moderation profiles for different content areas
  • Set up webhooks to get notified when content is blocked
  • Explore custom hooks to moderate third-party plugin content
  • Monitor your usage analytics in the SafeComms dashboard
Will Casey
Will Casey
Engineer at SafeComms

William is an engineer at SafeComms specializing in developer tools and integration patterns. He builds the SDKs and writes the guides that help developers ship safer platforms.