This question already has an answer here:

This question is very similar but not exactly the same as this.. One comment per user per post but be able to reply to existing comments

I'd like a js solution so it doesn't need to modify any of my theme files.

I'd like a commentor to be able post 1 comment only and then only be able to reply to that comment they posted.

marked as duplicate by TheDeadMedic, kaiser Apr 11 '16 at 0:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    If you would like a JS solution then the answer is that it is impossible – Mark Kaplun Apr 10 '16 at 15:23
  • Just write a custom plugin instead. – kaiser Apr 11 '16 at 0:04

Just with JS there is no way, because the visitor can reload the page or close window and reopen and reset everything.

You can create a table in your wordpress database where the user's name will be saved with 0 (if no comments was done) and the id of the post (if commented). So in one more column, you create the replies number, starting with 0 and go increasing up to 3.

With JS you can access the database via AJAX requisitions, and add one more count of replies and when it's 3, return a negative message.

This is the "JS way" that I see.

I Hope to help you.

  • there is no need for additional table, should be very easy to use the comments api to query the comments for the required conditions – Mark Kaplun Apr 10 '16 at 17:42

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