moderate attachments & comments with openai's free api
antisocial-safety.php | ||
readme.md |
openai moderation for attachments and comments
running a small website can be a hassle when idiots upload nasty stuff or spam your comments. this plugin uses openai's moderation api to automatically check images and comments for bad content.
why use this plugin?
it keeps your site clean by blocking offensive or illegal images and comments before they become a problem. saves you headaches.
features
- attachment moderation: images are checked during upload. flagged images are blocked. optionally, anonymize file names.
- comment moderation: comments are reviewed before they're saved. flagged comments are set to unapproved.
- admin integration: see moderation status directly in your media library and comments list. detailed info available in edit screens.
- easy setup: just add your openai api key in the settings.
installation
- upload the plugin files to
/wp-content/plugins/
, or install through the wordpress plugins screen. - activate the plugin.
- go to
settings
>openai moderation
and enter your openai api key.
how it works
attachment moderation
- when an image is uploaded, the plugin sends it to openai's moderation api using the
omni-moderation-latest
model. - if the image is flagged in any of the abuse categories, the attachment does not get created.
comment moderation
- before a comment is saved, the plugin checks the content with openai's moderation api.
- flagged comments are set to unapproved, so they won't show up on your site unless you approve them.
backend functionality
- hooks into
add_attachment
to moderate images upon upload. - hooks into
preprocess_comment
andpre_comment_approved
to moderate comments before saving. - stores moderation results in post and comment meta.
- adds custom columns in admin screens to display moderation status.
- provides detailed moderation info in the attachment and comment edit screens.
requirements
- wordpress 5.0 or higher
- an openai api key
notes
- if the openai api key isn't set, the plugin won't function.