WordPress Snippets at WPcustoms

Add ‘delete’ and ‘spam’ links to comments

Wouldn’t it be nice if you were able to mark a comment as spam, or even delete it, from your blog, without visiting your WordPress dashboard?
Add the following code where you want it to appear. It must be within the comment loop. On most themes, you’ll find a edit_comment_link() declaration. Add the code just after.

 * Snippet Name: Add ‘delete’ and ‘spam’ links to comments
 * Snippet URL: http://www.wpcustoms.net/snippets/add-delete-spam-links-comments/
 // usage: delete_comment_link(get_comment_ID());

function delete_comment_link($id) {
  if (current_user_can('edit_post')) {
    echo '| del ';
    echo '| spam';