Duško Oljača
Duško Oljača

Reputation: 49

How to Clear the Comment Form in Wordpress

I have a problem. I have a wordpress website and comment system. Is it normal behavior that when a user leaves a comment on a post that after submitting the form name field and email field are not cleared when it shows the post again.

Can anyone help me to clear the name and email field after saving the comment.

Upvotes: 2

Views: 280

Answers (2)

Peter Featherstone
Peter Featherstone

Reputation: 8102

Sounds like this is just a feature of the browser autocompleting the fields for them to save the user time in future.

The quickest thing you can do is add autocomplete="off" to the fields as explained here or to the entire form as explained here.

Interestingly according to the page from Mozilla here they actually suggest the following:

In some cases, the browser will keep suggesting autocompletion values even if the autocomplete attribute is set to off. This unexpected behavior can be quite puzzling for developers. The trick to really forcing the no-autocompletion is to assign a random string to the attribute, for example:

autocomplete="nope"

Since this random value is not a valid one, the browser will give up.

Upvotes: 1

Paul
Paul

Reputation: 380

This is a standard from our browsers Theses informations are not really saved on your website, but in your browser.

For test it, open a private screen in your browser, and check if the fields are empty or not.

Upvotes: 1

Related Questions