RSS feed

Nutsmuggling

Wordpress: disable moderation for a single comment

I am working an very complex portal based on Wordpress. The more I code, the more I befriend the functions.php file, where all my small tweaks reside. Last in the list (pun!) a super simple action to automatically approve comments belonging to a specific post (which I use as a guestbook):

function approve_guestbook_comments($comment_ID) {
	$comment = get_comment($comment_ID);    
	if ($comment->comment_post_ID == guestbook_page())
		wp_set_comment_status($comment_ID,'approve');
 
}
add_action('comment_post','approve_guestbook_comments');

As you see it’s a super-simple tweak, but it’s quite effective.

Enjoy,
Davide