What’s the easiest way to close comments on media/attachments?

This ought to do it: function wpse15750_comment_check( $id ){ if( get_post_type( $id ) == ‘attachment’ ) exit; } add_action( ‘pre_comment_on_post’, ‘wpse15750_comment_check’ ); EDIT Ignore the above. That will stop new comments, but to do what you want, this is much better: function wpse15750_comments_closed( $open, $id ){ if( get_post_type( $id ) == ‘attachment’ ) return false; … Read more

How to spam-filter a custom content type with the Akismet plugin?

Akismet – libraries: First I want to mention that there are many Akismet libraries out there: http://akismet.com/development/ and here are the API documents: http://akismet.com/development/api/ Akismet – WordPress plugin: But as I understand it, you want to use the Akismet WordPress plugin as your library. The following code snippet is a simple proof of concept, based … Read more

Tips for finding SPAM links injected into the_content

I won’t repeat any of the good advice in Squish’s answer. You should also read this article on WordPress security. I’m just going to cover the specifics of what I learned from my episode. My attack is a kind of black hat SEO known as “hideMeYa”: http://siteolytics.com/black-hat-seo-technique-demystified/ Basically, the attacker slips a bunch of hidden … Read more

A spam bot loves me, what can I do?

You actually want to keep these comments marked as spam–not trashed. Akismet checks against your spam list while deciding what to do with a new comment. So having a large database of spam comments actually helps Akismet work. I get what your issue is, but what you’re essentially asking for is a spam filter for … Read more

Experiences with adding Nonces to the comment form

I haven’t done this personally, but it would be pretty easy. If you are building your comment form manually, just before the end of the </form> put: <?php wp_nonce_field( ‘comment_nonce’ ) ?> Then, just hook into the pre_comment_on_post action which fires when you submit a comment: add_action( ‘pre_comment_on_post’, ‘my_verify_comment_nonce’ ); function my_verify_comment_nonce() { check_admin_referer( ‘comment_nonce’ … Read more

Removing the “Website” Field from Comments and Replies?

Create a file in wp-content/plugins/ with this code: <?php /* Plugin Name: Get Rid of Comment Websites */ function my_custom_comment_fields( $fields ){ if(isset($fields[‘url’])) unset($fields[‘url’]); return $fields; } add_filter( ‘comment_form_default_fields’, ‘my_custom_comment_fields’ ); Normally, I’d say put it into your theme’s functions.php file, but I wouldn’t recommend doing that for a theme that could update like Twenty … Read more