gwycon.com
Silverlight, WPF and C# .NET development
User NamePassword

24
Feb

Our first WordPress Plugin – ‘WP Content Filter’ version 1.0 has just been completed, and is available now for download. :)

It is compatible with the latest version of WordPress 2.7.1, and is designed to filter out any profanity (swearing to you and me!) and any other keywords specified on the Plugin options page.

The WP Content Filter Plugin has now been uploaded to the WordPress Plugins Directory. Also check out our WP Content Filter page for more information on this Plugin.

Installation instructions


Click for installation instructions and demo of Plugin

If you have any comments or suggestions then let us know. We will be adding many more features to the Plugin in due course so your suggestions are welcome.

Category : WordPress Plugins

29 Responses to “WP Content Filter 1.0 – WordPress Plugin”


Patrik Quadt February 27, 2009

Hi!

Very Good idea! Is it compatible with WordPress mu?? I really want something like that to filter out bad words on my Mu site….Can I use it Sitewide or do I have to change soem code??

/Patrik hosting myblogg.se

    David March 4, 2009

    Hi Patrik,

    Thanks for your comment. I haven’t used WordPress Mu before so therefore don’t know if this Plugin is compatible with it or not. It is something to look into for sure. If you happen to test it out then please let me know how it performs.

    I have tested it on the latest version of WordPress 2.7.1 and it performs quite well. There are some tweaks that still need to be made, as well the implementation of some more features/options in the admin control panel.

    So, watch this space! :)

    David

baron February 28, 2009

hi. Thanks for plugin

perfect.

Regards

Donald March 1, 2009

Hi! I
Can this plugin filter bad words which in non-western characters such as Chinese?

David March 1, 2009

Hi Donald,

If you have a language translation Plugin that translates English into another language (such as Chinese in your case), then I am not sure if the WP Content Filter will check keywords against the original English or the translated words.

It all depends on whether the text is checked for keywords first, or the translation is done first. If the keywords are checked first then the Plugin will work. Unfortunately more than one Plugin can access the same WordPress Plugin hook (i.e. that formats the post text, say) and I am not aware that there is a way to try and force your Plugin to run it’s code first before another Plugin.

But by all means try the Plugin if you need to use filtering of swear words on your site and let me know so I can inform others.

David

RaiulBaztepo March 29, 2009

Hello!
Very Interesting post! Thank you for such interesting resource!
PS: Sorry for my bad english, I’v just started to learn this language ;)
See you!
Your, Raiul Baztepo

Donald April 11, 2009

Hi David,
I have tested this plugin with some Chinese words, and it can not filter the Chinese words correctly (the test article turned unreadable as Chinese character is double-byte and it may be wrongly divided :) ).

David April 11, 2009

Yes, the Plugin works OK for English words, but is not guaranteed for any other language. Perhaps in the future other languages will be supported, but we are busy developing C# applications at the moment. Hence, our ‘free’ WordPress Plugins are on the back burner for now. :)

David

coda May 22, 2009

Great plugin, thanks for your efforts.

A useful addition would be to completely disable the post or comment if offending content is found. So instead of just changing the content, the post would be set as “Draft” instead of “Published” until the offending content is removed (and the same with a comment).

David May 22, 2009

Thanks for your suggestion, interesting idea!

David

John Lytle July 8, 2009

Hello, thank you for your efforts here.

I think another good idea woudl be to have phrase substitution. If a flagged word is found, be able to insert a specified word or phrase.

Victar Mas July 16, 2009

I noticed that you don’t filter whole words. There should definitely at least be a check box for this.

David July 17, 2009

@John Lytle: Hi John, Yes this is a good idea to have an option to replce filtered words with ‘safer’ ones.

David July 17, 2009

@Victar Mas: Not really sure what you mean here. The plug-in filters words/phrases as you enter them in the admin section settings, including whole words.

Kim July 22, 2009

when putting in keywords to filter, I get this error on any post that has profanity:
Fatal error: Call to undefined function: str_ireplace() in /homepages/8/d259151005/htdocs/xplicitspit/wp-content/plugins/wp-content-filter/wp-content-filter.php on line 131

Kim July 22, 2009

I think I’ve fixed it by removing the i before the word replace. I don’t know if that is correct, but when using a word like Passive, which has the word ass in it, it puts a star in the word. Is that the way it works?

David July 22, 2009

@Kim

The PHP function ‘str_ireplace’ is the case insensitive version of ‘str_replace’ so it may not work completely as expected even though you are now not getting any error messages.

The error is most likely caused by the PHP version you are running on your server. ‘str_ireplace()’ is a PHP 5 only function so you will need to be running version 5 or higher. To double check upload a test PHP file using the ‘phpversion’ function, see here for more details:

http://uk3.php.net/manual/en/function.phpversion.php

You could ask your web host ever so nicely when they plan to upgrade to PHP 5 but don’t expect them to upgrade soley on individual requests. Hope that helps!

David

Kim July 23, 2009

Hi David,
thanks for replying. As you can see, my host kindly upgraded me to php5 http://xplicitspit.com/phpinfo.php

The issue now is that any post that has an image in it, the words do not wrap around when the plug has the keywords in place. When I remove the keywords and update the plugin, the post is laid out correctly. Do you know what would cause this?

David July 23, 2009

Hi Kim,

Glad your host agreed to upgrade. Please remove the phpinfo.php page from public access as it could potentially be a security risk because it exposes a lot of server settings and configuration.

Hmm, not really sure what this problem is exactly. Could be the plug-in itself or a side effect of another one, but maybe just the plug-in itself.

It has been a while since I was working on this plug-in but as far as I remember I was simply altering the post feed when profanity keywords were encountered. No HTML/CSS was stripped intentionally. One thing to note is that any keyword in the html code will also be filtered so for example href=”somepath” and such code will be checked and replaced. This could potentially break some html code. But not sure if it is this that is causing your problem.

Unfortunately I am not actively developing the free WP plugins right now, as I am busy on other projects. I do intend to return to plugin develpoment and also some themes :) which I have not done before. The plug-ins need checking and updated to be compatible with the latest versions of WP, but as yet I do not know when I will have time for this.

David

Kim July 23, 2009

Thanks for replying back. The plugin works flawlessly for me expect this issue. I’ll have a coder look into the css files to see if there is anything going on.

Thanks again for getting back with me. Your time is appreciated.

Liz July 29, 2009

Thanks for the plugin.
Have I configured something wrong?
‘passenger’ is appearing as ‘p***enger’. clearly filtering ‘a**’.
Not really my intention.

David July 29, 2009

Hi Liz,

I’m afraid the limitation of the plug-in as it stands is that the list of keywords to filter does not distinguish between whole words or sub words. Therefore, the letters being filtered in the ‘passenger’ word as it appears on your blog match one of your keywords in the plug-in list.

This is not necessarily a shortcoming of the plug-in as people may try to hide profanities inside of other words in an attempt to keep them visible. In your case Liz this is an unwanted action as ‘passenger’ is obviously a word that shouldn’t be filtered even though it contains a match for one of your keywords to filter.

At the moment, the plug-in removes anything, wherever it encounters it, if it matches one of your chosen keywords. I am not too sure how useful it would be to include an option to simply ignore a keyword match for a case similar to yours, if it is found inside another word, for the reason mentioned earlier; as this would make it VERY easy for anyone to use profanities all over the place simply by enclosing them with other letters.

Perhaps a more elegant solution would be to have a second list of keywords that, if encountered, would be ignored by the content filter. So for example in your case Liz, the word ‘passenger’ could be entered into this second keyword list. Then, when it is encountered it is ignored (even though it contains a keyword that the current plug-in version would normally filter).

This way, you could override certain words that should NOT be filtered even though they may contain a sub word that flags a match in your profanity keywords. Plus, if another word had this profanity keyword embedded then it would still get filtered as normal!

I will be doing an update for this plug-in at some point which will include this update, but I cannot promise when this will be at the moment due to other project commitments.

David

gestroud September 18, 2009

Some additional words for the list :-)

Circumstance
Circumference
Constitutional Law
Passable

Detoam September 19, 2009

Awesome plug-in. I swear like there’s no tomorrow on my blogs. Some ppl apparently don’t like that. So thank You.
It does work in wp 2.8.4

Sakthi Ganesh November 24, 2009

I have found some issues with my setup ( may be with this plugin)

I have blacklisted the various offensive words using the filter textbox . one of the word is “ass” .I have included the conclusion that ,the plugin may find and replace the ” Three letter world” combination of “a”,”S”,”S” that forms the word “ass”.

But what it happened is
It blocked the words that start with particular three letter word .For example it blocked and replaced theword

“Assets” with ” ***ets ” which one i didn’t expected

For example the line is become

To protect the digital ***ets( which one is gone meaningless )

Is that any solution for that ?

Andrew February 25, 2010

placing this code in wp-content-filter.php (hacked from http://chumby.net/?p=44)

function str_replace_word($needle,$replacement,$haystack,$isInsen){
if($isInsen == “insen”){
$pattern = “/\b$needle\b/i”;
} else {
$pattern = “/\b$needle\b/”;
}
$haystack = preg_replace($pattern, $replacement, $haystack);
return $haystack;
}

AND THEN modifying the string replace towards the bottom of that page like this

if (true){ // IT IS A WHOLE WORD REPLACE – FROM CONFIG

if($filter_type == “insen”){
$text = str_replace_word($sub_search, $tmp_search, $text, “insen”);
}else{
$text = str_replace_word($sub_search, $tmp_search, $text, “”);
}

} else { // EXISTING IPLEMENTATION
if($filter_type == “insen”){
$text = str_ireplace($sub_search, $tmp_search, $text);
}else{
$text = str_replace_word($sub_search, $tmp_search, $text, “”);
}
}

Gives us a WHOLE WORD ONLY replacement – what I would think is more useful. It uses a regular expression to find the whole words only.
The “if (TRUE)” code is the “replace wholewords only” checkbox that would be in the WP configuration options (if I knew how to do it )

Hope that helps

Andrew February 25, 2010

FYI I have it running successfully on wordpress 2.9.2

o2 March 19, 2010

nice plugin. you may consider enhancing it by adding the ability to define what to replace keywords with, like forum filters.

it’s a fun trick to replace say, ‘moron’ with ‘mellon’

David May 30, 2010

Just to let everyone know, this plugin is back in active development. you can find the new official plugin page here: http://www.presscoders.com/plugins/free-plugins/wp-content-filter/

We also have support forums open for our free plugins. There is a small monthly subscription which gives you access to the support forums, and is basically in place to make sure that this plugin is kept up-to-date and give users peace of mind it will always be compatible with the latest version of WordPress, and that any bugs will be corrected as soon as possible.

You can find the forums here (just click the ‘Register’ button if you wish to sign up): http://www.presscoders.com/forums/