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

Share and Enjoy:
  • Digg
  • del.icio.us
  • Google
  • Technorati
  • StumbleUpon
  • Furl
  • Reddit

4 responses to “Wordpress: disable moderation for a single comment”

  1. dennis says:

    I don’t know php well. If I wanted to add this feature to another page, is it as simple as replacing the word “guestbook” with the page I want it on?

  2. David Peers says:

    This blog aided me somewhat in narrowing down some issues with the latest version, Why do they often seem to leave out vital information when they release a new version? It may be minor to them but not to me. I’m sure we’re not alone either.

  3. Download FLV Player says:

    Your blog has helped, thank you. I’ve encountered it maybe once or twice today and will very likely bookmark it. You may want to update wordpress as there is a new version accessible now!

  4. Scream 4 The Movie says:

    Your blog has helped, thanks a ton. I have found it once or twice now and will almost certainly take a note of it. You actually may would like to update wordpress as there exists a brand-new variant accessible now!

Leave a Reply