I got it, just took the code from wp-admin/edit-comments.php:
<?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
$url = clean_url(wp_nonce_url( "/wp-admin/comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ));
echo "<a href='$url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . "</a> ";
} ?>
758218
Thank you, for literally being the only person alive to not only post a problem, but bother coming back with a solution. 🙂
Thanks again!
(@blaenkdenum)
15 years, 10 months ago
Hey guys. As of now, when I view comments on posts by going to the post directly, I see edit links on each comment so that I can easily edit it. However, I’d also like to have a delete link in case it’s a muck up or something. I was trying to figure out how to construct a delete link but I wasn’t able to because it needs some wpnonce parameter which I can’t come up with. For example this is the URL that’s on the edit comment page:
http://www.blaenkdenum.com/wp-admin/comment.php?action=deletecomment&c=18608&_wp_original_http_referer=http%3A%2F%2Fwww.blaenkdenum.com%2Fwp-recaptcha%2Fquote-comment-18609%2F&_wpnonce=1149e0a370
The only thing I can’t come up with is the wpnonce field. Or is there a function in wordpress that constructs the delete comment URL?