=== Comment Filter ===
Contributors: williamlong
Donate link: https://www.williamlong.info/
Tags: comment, filter, comments, security
Requires at least: 4.6
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPL2
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html

Filter unwanted words in comments by replacing them with asterisks.

== Description ==

Comment Filter replaces unwanted words in comment text with asterisks. It hooks into WordPress at display time, so the original comment is kept in the database and only the output is filtered.

Features:

* Case-insensitive matching, so both uppercase and lowercase words are filtered.
* Support for multibyte characters, including Chinese.
* Fast single-pass replacement, safe even for long comments.
* The word list can be customized without editing plugin code.

By default, a built-in list of words is used. To change it, add the following to your theme's `functions.php` or a custom plugin:

`add_filter( 'comment_filter_banned_words', function() { return 'word1|word2|word3'; } );`

Separate words with the pipe character (`|`). To disable filtering, return an empty string.

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/` directory, or install it through the WordPress Plugins screen.
2. Activate the plugin through the Plugins menu in WordPress.
3. Optional: use the `comment_filter_banned_words` filter to set your own word list.

== Frequently Asked Questions ==

= Does this change comments in the database? =

No. Filtering happens only when comments are displayed. The stored comment is never modified.

= How do I add my own words? =

Use the `comment_filter_banned_words` filter, as shown in the Description section.

== Changelog ==

= 1.1.0 =
* Replaced the old loop with a single case-insensitive replacement for better performance.
* Added the `comment_filter_banned_words` filter for custom word lists.
* Added compatibility with current WordPress and PHP versions.
* Fixed potential issues with long comments.

= 1.0 =
* First stable version.
