WP Content Filter
The WP Content Filter plugin is also available on the WordPress.org plugin repository. The WP Content Filter has undergone a major overhaul recently. The latest version finally has the option to turn strict filtering OFF which means profanity keywords embedded in your site content are now ignored!
Brief Description: With the WP Content Filter plugin you can now easily protect your site by filtering out profanity, swearing, abusive comments and any other keywords specified in the plugin option page. There are plenty of other options available as you can see in the screen shot below.
The plugin options page can be found under the Settings Menu, and it has been completely overhauled for WP Content Filter v2.25.
To see an example of how the plugin works, the screen shot below shows a sample post with some content and a comment. The filtered keywords entered in the plugin options page are: ‘Saturn’, ‘Jupiter’, ‘Pluto’, ‘admin’. Also, the plugin is configured in this test to only filter post content and comments (including the comment author name). You can see how this affects the output below.
The post content, comments, and author name are all inspected and words matching the keyword filters are replaced with fully/partially blanked out words containing censored characters. You have a choice of several different characters to use, the default is an asterisk ‘*’. In this example the hash ‘#’ character is used.
It is important to note that the content filter plugin does NOT change the content in the WordPress database whatsoever. Instead, the plugin simply filters WordPress content directly before it is displayed on the screen. To reiterate: no content in the database is ever altered!
Development of WP Content Filter
We are keeping the plugin up-to-date, and from now on it can be considered to be in active development. To fit in with this we now have a support package available for WP Content Filter (in fact it covers all of our free plugins, which are published on the WordPress plugin repository).
As of 28th May 2010 our support forums are open and gives our plugin users a place to visit for premium support, for a very small cost. This helps to ensure that the plugin is continuously maintained and updated, and will always work with the latest version of WordPress.
How Does This Benefit You?
Using the WP Content Filter on your website whether it is for business, or a personal site, you want to make sure it performs as you would expect it to. We want you to have the confidence and peace of mind knowing you have someone to turn to for timely and friendly customer support.
Also, you will be able to see the latest news and announcements as well as the roadmap for the plugin, so you can catch a sneak peek of the new features that will be added in future releases. You will even be able to vote for particular features that are most important to you, and also interact with other plugin users in our exclusive forums.
For a limited time, an extra benefit is that you can sign up for a reduced rate. Sign-up today and save nearly 30% on the regular price!!
We also have lots more content planned which will be added to the site in the near future including: manuals, tutorials, videos and more. So there are even more reasons to join us!
Here’s a possible suggestion I made on WordPress.org
http://wordpress.org/support/topic/401508
This feature suggestion has now been added to the Plugin.
Would be awesome if other plugins could hook into your plugin.
Perhaps add the ability to return a boolean as an additional parameter to “wpcf_filter()”, then we could do awesome things like block posts from publishing, etc.
Just a thought!
Pretty interesting idea, I will add this to the list and take a look how it could be implemented. Thanks for the suggestion.
David
This really is interesting but not sure how this would work in practice for the wpcf_filter() function, as this simply hooks into the content for various different filters (i.e. the_content, tags, comments etc.). To work properly this MUST return back the (modified) content so it wouldn’t be able to return a boolean etc.
If you have any suggestions for a practical implementation then I will test out some sample code for sure.
One approach could have been to add a custom hook inside wpcf_filter() so that you could hook into this in your own code and I could pass the before and after filtered text to the hook callback. Then you could simply see if there had been any replacements, and if so you could choose whether to block that content?
I’m not even sure that would work but in any case I don’t think it would work as the wpcf_filter() function handles other content such as tags, comments etc.
If you have any ideas then please let me know.
I’m using this plugin for a client who wants to delete certain company names (so that organizations being discussed remain anonymous) and for the most part it’s working great. But I noticed that a forward slash in any of the block words breaks it and causes it to turn anything that’s filtered into an empty string.
You probably know why this happens — it breaks the preg_replace call. So you just need the following at the beginning of str_replace_word() and str_replace_word_i():
$needle = str_replace(‘/’,'\/’,$needle);
We’d appreciate if you could include that in your next update. Thanks!
Will take a look at this for the next update.
Been looking into this and have made some changes to the latest development version of the Plugin. This ‘sort’ of works, not sure why it doesn’t fully work it appears as though it should – but not quite.
You are welcome to have a look at the latest code here (you will need to svn checkout the code): http://plugins.svn.wordpress.org/wp-content-filter/trunk
Let me know how you get on, and if you have a better fix let me know and I will add it to the next release version.
I’m interested in a pre-defined list of generic offensive words and phrases which I could customize. I don’s see that as part of your plugin. In this something I can download or can you suggest a resource that would save me time in setting up the plug in to catch the majority of offensive terms?
I didn’t add this as I felt it wasn’t appropriate to include it with the Plugin. Also, what people consider offensive terms is pretty subjective so is pretty hard to create a generic set of phrases.
Hi David, thanks for the great pligin. I got V1.0 from a google search and it worked great and then I updated to the latest to get all the great new features and now it’s not working. I’ve updated my list, checked options twice. Etc. Any ideas? Thanks!
Please make sure that you are running the latest version of WordPress. If the problem persists then temporarily deactivate all other Plugins and maybe also revert your theme to the default Twenty Eleven theme (you will need WP 3.2.1 for this). This is to test the WP Content Filter Plugin without any them code or other Plugin code getting in the way.
Please try the above, and if the problem persists can you let me know the exact error message or problem you are still experiencing?
Thanks for the quick reply! I tried those and still same thing. The key words remain without filtering. I could always switch back to v1.0 but I like the first/last letter retained option.
It should work fine in that case. We have it running here on Press Coders. For example the word f.i.z.z.y if written as a whole word comes out as Fizzy (I am not inserting the asterisks here, the Plugin is).
Ok, well I guess I’ll just leave the plugin active in the background and see if it ever kicks in. Or maybe switch back to v1.0. Thanks David
If you have access to a local WP install please try it on a completely fresh install to see that it works OK. There must be something about your WP installation that is causing a conflict.
I have just deleted/re-installed the Plugin from the repository and it still works OK.
Is it possible for buddypress to use this plugin as well?
I haven’t tested it with BuddyPress so can’t say. Best way is to try it and see.
Hi David,
It seems that WP Content Filter does not work with BuddyPress. I tested it on BP 1.5.1 and it did not affect the activity stream. I also tested it with bbpress 2.0 and it did not work there either.
If it worked with these two, that would be AWESOME!
Very nice job on the plugin!
Hi Bruce,
WP Content Filter works with several core WordPress filters (for content, comments etc.). It doesn’t know anything about BP by default as that brings in functionality via a Plugin. It would potentially be pretty cool if the two worked together but I have barely ever used BP so don’t know the system very well.
If you know of one or more BP filters that I can tap into if it is installed then I can probably code up something pretty quickly. Otherwise it might be sometime and depend on when I have time to take a proper look at BP. Which looks amazing by the way!
David
I have a problem with the plug. Filters the entries sensational, but if the main page I will add a plugin could display recent comments along with the text, it’s profanity is visible.
I use this plug-rescent Wizzard posts
Sorry for the mistakes of language, but poorly know English.
That Plugin must be showing the comments before the WP Content Filter Plugin filters the comment content. You can try upping the priorities of the hooks in the content filter Plugin see if that works.
I know what’s going on, but I have no idea where it is set. Excuse me, but when it comes to WP, I am not a programmer … Can you explain it step by step?
I’m not even sure if upping the priorities would even work. It is just a guess. I don’t have time to look into it right now. If your other comments Plugin is causing conflicts with the filter Plugin I would try another one, see if that helps.
Hi, I’m building a site for a school and need to add a profanity filter. Your plugin works perfectly for the main content item, but does not filter out the set words in the category/archive pages. Is there any way I can achieve this?
May I suggest that besides compatibility with bbPress, you should be adding similar support for Buddypress in the future versions of this plugin. Here’s what I have patched to make it work with Buddypress:
// Forum titles, topics and replies
add_filter(‘bp_get_the_topic_title’, ‘pccf_filter’);
add_filter(‘bp_get_the_topic_post_content’, ‘pccf_filter’);
// Activity title & content
add_filter(‘bp_get_activity_action’, ‘pccf_filter’);
add_filter(‘bp_get_activity_content_body’, ‘pccf_filter’);
Thanks for the suggestion I’ll add it to the @to-do list.
You would also have to give more specific code for me to implement that or it will likely sit on the back burner indefinitely.
For example to support bbPress I added code to check for the existence of the bbPress class before adding the filters. I wold need similar to implement adding Buddy Press filters etc.
Using v2.31
Get error in log
WordPress database error MySQL server has gone away for query SELECT option_value FROM wp_options WHERE option_name = ‘plugin_error’ LIMIT 1 made by shutdown_action_hook, do_action(‘shutdown’), call_user_func_array, pc_show_plugin_error, get_option
This one echoed on purpose??
Thanks for reporting this. I have just patched this issue and released a new version (2.32).
Fixed in less than 24 hours – superlative product, superlative service!
Thanks for the kind words Hal. We aim to please!