2

I'm wondering if there's any way to prevent users from leaving comments but still display the comments form? So, whenever a new comment is posted, it should be automatically trashed or it shouldn't be added at all.

The comment form I have is for presentational purposes only and it shouldn't accept any comments but it should be displayed.

I've already found preprocess_comment and comment_post hooks but I'm out of ideas on how to utilize that to block commenting. I'm thinking about something like:

function prefix_delete_comments( $comment_id ) {
  wp_delete_comment( $comment_id, true );
}
add_action( 'comment_post', 'prefix_delete_comments');

but will this work or will it cause some errors in later execution?

  • 2
    You can try this if you want to disable comments but still want to have the comment form visible. – birgire Oct 24 '13 at 1:46
0

(copied from comment above, so that this question will get an answer):

You can try http://wordpress.stackexchange.com/a/89238/26350 if you want to disable comments but still want to have the comment form visible. – birgire Oct 24 '13 at 1:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.