I can delete the comment from the database with this code, however when the page is loaded again the comment will still be there. I need to update again to disappear.
How do I resolve this?
<?php if( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
set_query_var( 'commentid1', $_POST['commentid'] );
wp_delete_comment( get_query_var( 'commentid1'), true );
};
?>
<form class="delete-comment" action="" method="post">
<input type="hidden" name="commentid" value="<?php comment_ID() ?>" />
<p align="right">
<input type="submit" value="Delete" title="Delete" />
</p>
</form>