0

I have a edit comments page on my sites front end and have placed a delete comment link for users. The link works however it takes the user to the backend to confirm the comment deletion. I cant have any users going to the backend though, so what can I do to avoid this step?

I tried looking around and found someone with a similar problem but besides that I can not find any help on this. https://wordpress.org/support/topic/directly-delete-comments-in-template-no-admin-step-please

The code Im using to generate the links on my comment form on the front end --

<?php 
    echo ' <a href="'.admin_url("comment.php?action=cdc&c=$comment_id").'">[Delete]</a>';
    echo ' <a href="'.admin_url("comment.php?action=cdc&dt=spam&c=$comment_id").'">[Spam]</a>'; ?>

It works fine except the 2nd step of confirming the comment delete from the back end. What can I do?

  • So the users need to be logged in the comment on your system, correct? Or this deletion ability would only be accessible to logged in users – Howdy_McGee Dec 1 '15 at 18:18
  • @Howdy_Mcgee - is this a question? Without login access how do allow an unknown user to moderate a comment.? – Kvvaradha Dec 2 '15 at 2:08
  • Just making sure you're not asking the 'impossible'. You would be surprised. I'll come back with something substantial in a bit. – Howdy_McGee Dec 2 '15 at 2:10
  • Maybe try one of these two plugins. Another option would be to use AJAX because by using functions like admin_url() you won't be able to keep it on the front-end. – Howdy_McGee Dec 2 '15 at 2:53
  • @Howdy_McGee the users need to be logged in, but only the admin is allowed on the back end. How would I do it through ajax then? – Rich Dec 2 '15 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.