How to Add Spam and Delete Action Links to WordPress Comments
As we know, we just only can see the edit action link in the comments of wordpress blog when we logged in. If you want to delete or mark the comments as spam, we should click the edit action link ,go into dashboard and finish the manipulation.
And now, it’s easy to add the delete and spam action link to the comment template, and you can clean your comments easily from the post. Firstly, you should open the functions.php file and add this code.
Spam and Delete Link
function delete_comment_link($id) { if (current_user_can('edit_post')) { echo '| <a href="'.admin_url(">del</a> '; echo '| <a href="'.admin_url(">spam</a>'; } }
And than, find the edit_comment_link function in your comment.php or the functions.php file, add this code after the edit_comment_link function.
delete_comment_link(get_comment_ID());
Your edit link code may look like this.
<?php edit_comment_link('Edit', ' | ', ''); delete_comment_link(get_comment_ID()); ?>
If you don’t like coding, you can try the WP AJAX Edit Comment plugin. It’s an awesome and powerful wordpress plugin.







