There are so many WordPress plugins tagged spam published in WordPress plugins directory. Most of the plugins is to combat spam comment in WordPress blog. However, I am not use one of those plugins, because of several reasons: they are captcha based (eg. re-Captcha) and they are using API (eg. Akismet). In my experience, using both type of anti spam could decrease my blog performance.
For that reason I have a few tips for you to combat spam without sacrificing your web performance:
1. Never install any anti spam plugins that come with captcha, API, or remote database access.
2. Some plugins will count your spam, haha… it’s funny. Do not install such plugins.
3. Ensure you have these setting in wp-admin/options-discussion.php
– An administrator must always approve the comment ( This should be ON)
– Comment author must have a previously approved comment (This should be OFF)
4. Use built in WordPress feature, blacklist comment. See figure below:
6. Delete spam comment automatically. To do this I have written a little plugin named Delete Spam Hourly.
Here is the code:
[php title=Delete Spam Hourly]
/* Plugin Name: Delete Spam Hourly Plugin URI: / Description: Automatically delete blacklisted comment/spam every hour. Author: takien Version: 0.1 Author URI: / */register_activation_hook(FILE, ‘activate_delete_spam_hourly’); add_action(‘delete_spam_hourly_event’, ‘delete_spam_hourly’);
function activate_delete_spam_hourly() { wp_schedule_event(time(), ‘hourly’, ‘delete_spam_hourly_event’); }
function delete_spam_hourly() { $pending = ‘0’; $spam = ‘spam’;
global $wpdb; $comment_ids = $wpdb->get_col( “SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = ‘$pending’ OR comment_approved = ‘$spam’” );
foreach ($comment_ids as $comment_id){ $comment = get_comment($comment_id, ‘ARRAY_A’); if(wp_blacklist_check($comment[‘comment_author’],$comment[‘comment_author_email’],$comment[‘comment_author_url’],$comment[‘comment_content’], $comment[‘comment_author_IP’],$comment[‘comment_agent’])){ wp_delete_comment($comment_id); } } }
[/php]


Komentar (4)
Arsip Statis