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: https://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';
  }
} 

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x