ajax – How to Call WP Function from JS
Question
I am trying create a button that allows comment authors to delete their comments. In my comments.php I have::
<button onclick="test()"> Click </button>
<script>
function test() {
// I want to call wp_delete_comment() here
}
</script>
but I am not sure how to do this. I’ve tried looking at many solutions for other people using AJAX but have had no success. Could someone describe how I can accomplish this?
0
8 months
2022-05-27T16:06:05-05:00
2022-05-27T16:06:05-05:00 0 Answers
0 views
0
Leave an answer