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? If you’re interested, read on, you’ll probably not regret it
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? If you’re interested, read on, you’ll probably not regret it
First, we have to create the function. Paste the code below on the functions.php file from your theme. If that file doesn't exists, create it.
function delete_comment_link($id) {
if (current_user_can('edit_post')) {
echo '| <a href="'.admin_url("comment.php?action=cdc&c=$id").'">del</a> ';
echo '| <a href="'.admin_url("comment.php?action=cdc&dt=spam&c=$id").'">spam</a>';
}
}
Then, edit your comments.php file. 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.
delete_comment_link(get_comment_ID());
Credits goes to Joost de Valk for this awesome recipe!
26 Responses
looks good, but what about the “spam” code?
Thank you for the great tip.
This will help me delete comments which get past Akismet.
You got yourself another feed subscriber.
@Sarbjit Singh: Glad to see you enjoyed this recipe!
This will really help. thanks for the tip. I have edit this link i will put call to this function beside this in comments.php.
Thanks
Thanks for this tip; I love little details like this that make it easier on bloggers. I’m building the feature into my “base theme.”
hy hello , i use your code in my themes and i would like to thank you but lately , since the upgrade of wordpress to 2.9 there seems to be a problem that is occuring due to this code that i use of yours , only on pages that has comments , the comment form seems to be dissappearing after entering a comment , please if possible try to help us with regard of this code , thanks again
is there a way to do it using filters?
witout editing the “comments.php” template file?
Trackbacks: